0

why this program is not working proper?

#include<iostream> using namespace std; int student () { int a,r; char c; cout<<"Enter the name of student= "; cin>>c; cout<<"Enter the roll number of the student = "; cin>> r; cout<<"Enter the Age of student = "; cin>>a; } int main() { student(); return 0; }

15th Aug 2020, 2:15 PM
Abhishek Kumar
Abhishek Kumar - avatar
2 Answers
0
make it string c instead char c. Name is a string , not a char. Also make your function' s return type as void .
15th Aug 2020, 2:16 PM
Hima
Hima - avatar
0
And you are not outputting any values... Display after taking values.. Like cout<<c; And add return statement to start function or make it void...
15th Aug 2020, 2:19 PM
Jayakrishna 🇼🇳