Page 1 of 2
Posted: Tue Apr 23, 2002 5:11 pm
by +rumpled45k1n+
I need a simple C++ program for the following problem, can anyone help?
A string value is to be read in from the keyboard. The string will comprise a name and address with the elements separated by asterisks, such as:
John*Smith*123 The Avenue*Some Town*B91 1NP
The program has to write this string out in the following format.
John Smith
123 The Avenue
Some Town
B91 1NP
The number of elements in the string entry (which will become the number of lines in the written-out format) is not fixed. That is, the number of asterisks in the input string is not known in advance.
You should base your design on first reading in the string to be formatted and then writing out the revised string. Do not attempt to write out the characters as you read them in. Your program should handle whatever input string is received from the user. For example, if the user enters a string with no asterisks included, your program should write out the same string. Every asterisk should produce a new line in the output.
Posted: Tue Apr 23, 2002 5:25 pm
by monkeys_heed
10 print John Smith;
20 goto 10
run
will that work??
anyway why are you still at work? has wullie buggered off leaving you with all the work?
Posted: Tue Apr 23, 2002 5:29 pm
by ianskate
it gets the whole string. searches for a star. it reaches a start, and inserts /n, and prints the first portion of the string.
if i knew enough C++ i might be able to figure it out, but i dont... and if i knew enough Java, i could help you... but i dont know enough java either...
sorry
Posted: Tue Apr 23, 2002 5:38 pm
by +rumpled45k1n+
10 print John Smith;
20 goto 10
run
will that work??
anyway why are you still at work? has wullie buggered off leaving you with all the work?
/me is on holiday to catch up on uni stuff
/me up shit creak need to finish tonight
Posted: Tue Apr 23, 2002 5:41 pm
by Under The Influence
Posted: Tue Apr 23, 2002 5:43 pm
by +rumpled45k1n+
I could do it in C
c would b just fine
Posted: Tue Apr 23, 2002 5:45 pm
by Under The Influence
I could do it in C
c would b just fine
give me 10 minutes
Posted: Tue Apr 23, 2002 5:46 pm
by +rumpled45k1n+
I could do it in C
c would b just fine
give me 10 minutes
thanx
Posted: Tue Apr 23, 2002 6:36 pm
by Under The Influence
I could do it in C
c would b just fine
give me 10 minutes
thanx
turns out i cant do it in C, sorry, ? :(
If i had more time i probably could but i dont... got my own Uni work to do
Posted: Tue Apr 23, 2002 6:42 pm
by +rumpled45k1n+
i had more time i probably could but i dont... got my own Uni work to do
no probs, thanx for trying