Programming help

i just started a programming class for C++ and have this assignment
and i am stuck..
#include <iostream>
using namespace std;

int main()
{
{

int name = 1;//initialize the counter
char studentName;


while(name =10&& name!=0)
{

cout <<"Enter student name"<<endl;
cin >> studentName;

name ++;

}

cout <<"The student names are:"<< studentName <<endl;
cout<<"The student names are as follows"<<endl;
system("pause");
return 0;
}
}
I'll wager a guess...

1
2
char studentName;//this is just a character try..
char studentName[50];//a character array or c-string 


1
2
while(name =10&& name!=0)//replace this with
while(name <=10)//name != 0 isn't necessary sinceyou initialized it 
Last edited on

Thanks for your help!!!
the problem is when i run it i get the following output


Enter student name
kelvin njuguna
Enter student name
Enter student name

it does not let me add another students name..
I wonder how too...tried on naraku code, it's only shows the last name after last input, but not all the 10 names...
Topic archived. No new replies allowed.