|
-
Jan 6th, 2001, 08:32 PM
#1
Thread Starter
Frenzied Member
Code:
char Name[101];
int Phone;
char Address[101];
cout<<"Enter the name of a person: "<<endl<<">";
cin.getline(Name,101,'\n');
cout<<"Enter "<<Name<<"'s phone number: "<<endl<<">";
cin>>Phone;
cout<<"Enter "<<Name<<"'s address: "<<endl<<">";
cin.getline(Address,101,'\n');
cout<<"========================================"<<endl;
cout<<"Name: "<<Name<<endl<<"Phone: "<<Phone<<endl<<"Address: "<<Address<<endl;
This is my code, but when it runs, it doesn't execute the bold part. Why is this? Is it just my computer?
-
Jan 6th, 2001, 09:05 PM
#2
Thread Starter
Frenzied Member
It works now but only because I changed the Phone number to a string. Can you only call these once? Do I have to call something to end a getline?
-
Jan 7th, 2001, 09:00 AM
#3
Addicted Member
does the address have a space in it sometime a compiler mite think the space is the send of it . but i dont know
WHat would we do with out Microsoft.
A lot more.
-
Jan 7th, 2001, 10:27 AM
#4
Frenzied Member
I tend to use stdio.h's Gets to get a whole line.
Code:
void Main()
{
char sIn[120];
gets(sIn); //get the whole line
return;
}
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Jan 7th, 2001, 11:05 AM
#5
Thread Starter
Frenzied Member
Its not because of a space (I've tried it with my name) and the ending character is '\n'
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
|