0

[SOLVED] Write a c++ program to request the full name, index number, program and section of a student and then output.

this is the code I'm having please #include <ios stream> using namespace std; into main() { char full name, index number, program, section; cout << "Enter Your full name"; cin>> fullname; cout <<"Enter your index number"; cin>> index number; cout << "Enter program"; cin>> program; cout <<"session of a student"; cin>>session; cout<< The full name of the student <<fullname<<with index number<<index number<<program<<program<<and session is<<session<<endl; } return 0;

19th Mar 2020, 6:44 PM
Bismark Abban
Bismark Abban - avatar
5 Réponses
0
U named a variable with spaces which is not correct Index number should be index_number or indexnum, same with fullname. The correct spelling is <iostream> You should use string instead of char. correct the printing part too, cout << "Full name of student: " << fullname << endl; cout << "Index Number of student: " << indexnum << endl; cout << "Program of student: " << program << endl; cout << "Session of student is: " << session;
19th Mar 2020, 7:17 PM
maf
maf - avatar
+ 5
We don't write code for people here. Please show us your attempt and tell us what specific problem you have, then we may give you a hint.
19th Mar 2020, 6:49 PM
HonFu
HonFu - avatar
+ 1
OK.. Thank you
19th Mar 2020, 7:18 PM
Bismark Abban
Bismark Abban - avatar
0
If u want to show something on screen, use std::cout << "Hello"; If you want to ask for a name, type std::cout << "Enter name: "; Simple. But if u wanna store a value so that u can use it later u have t use std::cin >> username; alright?
19th Mar 2020, 6:53 PM
maf
maf - avatar
0
I'm not sure if it's the right code for the answer above
19th Mar 2020, 7:12 PM
Bismark Abban
Bismark Abban - avatar