|
-
December 3rd, 2008, 09:35 AM
#1
how to get the string inputted by a user
Hi. I'm a college student taking up Computer Science right now we're just in repetition structure and i just want to know how to get the user inputted string..right now this is my program:
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
char name;
float ave1, ave2, ave3, genave;
for(int x=1; x<=10; x++)
{
cout<<"Enter Student's Name: ";
cin>>name;
cout<<"Enter 1st Term Average: ";
cin>>ave1;
cout<<"Enter 2nd Term Avergae: ";
cin>>ave2;
cout<<"Enter 3rd Term Average: \n";
cin>>ave3;
}
getch();
return 0;
}
i want the user to input his/her full name not just a nickname. If i use gets() the cursor will jump to Enter 1st Term Average and not in Enter Studen's Name.
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
|