Structure of the Problem Requirements
Goto statement provide a jump without any condition to the goto specific label in a function. Through goto stalemate we also make our program infinite . But goto statement leave badly impact on the flow of program and programmer and developers recommend to avoid it.
Source Code
#include<iostream>
using namespace std;
int main()
{
string name ;
int ID ;
string job;
char choice;
welcome:cout<<endl;
cout<<" Enter Your Name : ";
cin>>name;
cout<<" Enter Your ID : ";
cin>>ID;
cout<<" Enter Your Job Title : ";
cin>>job;
cout<<" Do You want to Stay with us? Y/N : ";
cin>> choice;
if (choice == 'Y')
{
goto welcome;
}
if (choice == 'N')
{
return 0;
}
}
Output of the Program
0 comments:
Post a Comment