DevelopersSociety

Tuesday, December 9, 2014

C++ Tutorial- Program- 4- else If Statement- Registration form


Code:

#include<iostream>
#include<string.h>
using namespace std; 
main()
{   
    string name,rollno,date; 
    char character; 
    cout<<"Enter your Name:";
    cin>>name;
    cout<<"Enter your roll no:";
    cin>>rollno;
    cout<<"Enter your date of birth:";
    cin>>date; 
    cout<<"Select Gender(M/F)"<<endl;
    cin>>character;
if(character=='m'||character=='M')
cout<<"Your Gender: Male"<<endl;
else if (character=='f'||character=='F')
cout<<"Your Gender: Female"<<endl;
else
cout<<"Must Select Gender"<<endl;
}

Output:


No comments:

Post a Comment