-
December 8th, 2008, 10:38 PM
#1
Need some help with char reading...
Im making a program in C++ and i need a little help. Ita my first semester in C++ so im still kind of a noob, but i dont remember how to get a while statement to continuosly read from a string until there are no more characters, as well as terminate the loop once the string is read. Basically the program is designed to use an end of line loop that continues to get roman nemeral characters from the user and convert them until the user hits enter. Any help is appreciated =)
-
December 9th, 2008, 05:05 AM
#2
Re: Need some help with char reading...
Use strlen() to get the string length. This is the number of times you should loop.
Or, if you want to stop at newline instead:
Code:
char c, *p=str;
while((c=*p++) != '\n') {
...
}
Nobody cares how it works as long as it works
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|