TALK IN CLASS AND QUIZ IN CPP BY PRADEEP
#include<iostream>
#include<conio.h>
using namespace std;
class talk
{
char name[15],name1[20],y;
int a;
public:
void dis1();
void dis2();
void dis3();
};
void talk:: dis1()
{
cout<<"Hello! how are your"<<endl;
cin>>name;
}
void talk::dis2()
{
cout<<"Ohh! nice can you tell me what's your name"<<endl;
cin>>name1;
}
void talk::dis3()
{
cout<<name1<<" you are best person in the world! \n would you like to play a Quiz reply only y or n"<<endl;
cin>>y;
switch (y)
{
case 'y':
cout<<"Ok the Quiz is started\nA.What is a correct syntax to output Hello World in C++?\n1.printf(""Hello world"")\n2.cout<<""Hello world"""<<endl;
cout<<"(note:- reply only 1 or 2)"<<endl;
cin>>a;
switch (a)
{
case 2:
cout<<"congratulation! you are win "<<endl;
break;
default:cout<<"Sorry but the answer is 2"<<endl;
break;
}
break;
default:cout<<"OK bye nice to talk your !"<<endl;
break;
}
}
int main()
{
talk t;
t.dis1();
t.dis2();
t.dis3();
}
Superb pradeep
ReplyDelete