Programming

C++ Take Input Name, Class, and Roll Number from User and Display

Write a program in c++ that can ask for name, class and roll number  and display as Hello Your class is and your roll number is

[button color=”red” size=”big” link=”https://namecheap.pxf.io/c/2001466/1291734/5618″ icon=”” target=”true” nofollow=”true”]Don’t miss: .COM for just $0.98![/button]

C Code

#include<iostream.h>
#include<conio.h>
void main()
{
char name[20];
char clas[6];
int roll;

cout<<"nEnter Name:";
cin>>name;
cout<<"nEnter Class:";
cin>>clas;
cout<<"nEnter Rollnumber:";
cin>>roll;

cout<<"nHello!!t"<<name<<"nYour class ist"<<clas<<"nYour rollnumber ist"<<roll;

cout<<"nThank you";

cout<<"nPress any key to continue…";

getch();

}

Output

Tuts

About Author

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.