c++ problem

+rumpled45k1n+
Posts: 30
Joined: Tue Apr 16, 2002 9:05 pm

Post 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.


monkeys_heed
Posts: 209
Joined: Fri Apr 19, 2002 1:58 pm

Post 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?


ianskate
Posts: 80
Joined: Mon Apr 08, 2002 1:33 am

Post 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


+rumpled45k1n+
Posts: 30
Joined: Tue Apr 16, 2002 9:05 pm

Post 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


Under The Influence
Posts: 70
Joined: Sat Apr 20, 2002 11:00 am

Post by Under The Influence »

I could do it in C

+rumpled45k1n+
Posts: 30
Joined: Tue Apr 16, 2002 9:05 pm

Post by +rumpled45k1n+ »


I could do it in C

c would b just fine


Under The Influence
Posts: 70
Joined: Sat Apr 20, 2002 11:00 am

Post by Under The Influence »



I could do it in C

c would b just fine



give me 10 minutes


+rumpled45k1n+
Posts: 30
Joined: Tue Apr 16, 2002 9:05 pm

Post by +rumpled45k1n+ »




I could do it in C

c would b just fine



give me 10 minutes



thanx


Under The Influence
Posts: 70
Joined: Sat Apr 20, 2002 11:00 am

Post 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


+rumpled45k1n+
Posts: 30
Joined: Tue Apr 16, 2002 9:05 pm

Post by +rumpled45k1n+ »


i had more time i probably could but i dont... got my own Uni work to do

no probs, thanx for trying


Locked