How To Repeat It?????

How To Repeat that program many many times????

#include<iostream.h>
#include<conio.h>
#include<cstring.h>
class quiz
{
public:
void choice()
{
string choice;
cout<<"The Abbrivation Of:";
cin>>choice;
if(choice=="IP")
cout<<"Internet Protocol";
if(choice=="ip")
cout<<"Internet Protocol";
else if(choice=="OOP")
cout<<"Object Oriented Programming";
else if(choice=="oop")
cout<<"Object Oriented Programming";
else if(choice=="SAD")
cout<<"System Analysis And Design";
else if(choice=="sad")
cout<<"System Analysis And Design";
else if(choice=="TCP")
cout<<"Transfer Control Protocol";
else if(choice=="LAN")
cout<<"Local Area Network";
else if(choice=="lan")
cout<<"Local Area Network";
else if(choice=="WAN")
cout<<"Wide Area Network";
else if(choice=="wan")
cout<<"Wide Area Network";
else if(choice=="MAN")
cout<<"Metropolian Area Network";
else if(choice=="man")
cout<<"Metropolian Area Network";
else if(choice=="DBA")
cout<<"Data Base Administrator";
else if(choice=="dba")
cout<<"Data Base Administrator";
else if(choice=="RAM")
cout<<"Random Access Memory";
else if(choice=="ram")
cout<<"Random Access Memory";
else if(choice=="ROM")
cout<<"Read only Memory";
else if(choice=="rom")
cout<<"Read only Memory";
else if(choice=="TCP")
cout<<"Transfer Control Protocol";
else if(choice=="tcp")
cout<<"Transfer Control Protocol";
else
cout<<"!!WRONG ENTRY!!\n";

}
};
void main()
{

cout<<endl;
cout<<"\t\t ^^^-^^^-^^^-^^^-^^^-^^^-^^^-^^^-^^^-^^^-^^^\n";
cout<<"\t\t ^^^^^^^ WELCOME T0 \"IT Acronym Quiz\" ^^^^^^\n";
cout<<"\t\t ^^^-^^^-^^^-^^^-^^^-^^^-^^^-^^^-^^^-^^^-^^^\n\n";
cout<<endl;
cout<<"**************ENTER FROM THE FOLLOWING ABRIVATIONS**************"<<endl;
cout<<endl;
cout<<"*******[TCP],[SAD],[RAM],[ROM],[DBA],[IP],[TCP],[LAN],[MAN],[WAN]!!!!**********"<<endl;
cout<<endl;
quiz h;
h.choice();
getch();


}
1
2
3
4
5
6
int main()
{
   begin:
   //code goes here
   goto begin;
}

or
1
2
3
4
5
6
7
int main()
{
   while(1)
   {
      //code goes here
   }
}

and some compilers support
1
2
3
4
5
int main()
{
   //code goes here
   return main();
}
Last edited on
1) Evil, that's not what goto is for.
2) Good
3) Non-standard, you aren't allowed to call main() ever
@firedraco

I know I've heard its bad a million times. But what exactly is wrong with it, other than personal preference? I mean technically, how is it different from a while loop?
It's bad because there is a while loop, which you should use instead.
Sorry, that doesn't really answer my question.
It is probably the same as a while loop, but the main issue is that it can easily lead to spaghetti code that you understood when you wrote it, but not 2 months later. It also is ambiguous since your goto could be a loop, a jump, a return, etc. Another issue is that it does not have scope so you could theoretically skip constructors or initializations of variables or other things.
Topic archived. No new replies allowed.