Example code:
[spoiler]#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
using namespace std;
int main()
{
ofstream myFile ("AI.txt");
int age, address;
char selection, character[1];
string name, response;
a:cout<<"Menu:\n9 = Basic Information.\n8 = DATALOG\n7 = Chat.\n0 = Leave\n";
cin>>selection;
switch (selection)
{
case '8' : system("AI.txt notepad.exe");myFile.open("AI.txt");myFile.close();system("CLS");goto a;
case '0' : return 0;
case '9' : goto c;
case '7' : goto e;system ("CLS");
default : cout<<"Nope"<<endl;system ("CLS");goto a;
}
d: cout<<"AI: What is your name?"<<endl;
cin>>name; system ("CLS");
myFile<<"Datalog"<<"\nName: "<<name<<endl;
cout<<"AI: How are you feeling?"<<endl<<name<<": ";
cin>>response; system ("CLS");
if (response == character) {cout<<"Invalid answer";}
myFile<<name<<" is feeling "<<response<<endl;
cout<<"AI: What is your age "<<name<<"?"<<endl<<name<<": ";
cin>>age; system ("CLS");
myFile<<name<<"'s age is "<<age;
myFile.close();
if (! myFile)
{
cout<<"Error";
}
goto a;
c: system ("CLS");cout<<"3";Sleep (1000);system ("CLS");cout<<"2";Sleep (1000);system ("CLS");cout<<"1";Sleep (1000);system ("CLS"); goto d;
e: cout<<system("CLS");
cout<<"Menu:\n9 \n8 \n7 \n6";
cin>>selection;
switch (selection)
{
default : cout<<"Nope"<<endl;system ("CLS");goto a;
}
system ("pause");
}[/spoiler]
[spoiler]#include <iostream>
using namespace std;
int main()
{
int r = 0 , l = 1;
char r0 = 0, l0 = 1, letter = r||l;
e: cout<<"menu = m: ";
c: if (r0 != l0){cin>>letter;}
a: switch(letter)
{
case '0' : cout<<"Right, "<<endl;{goto b;}
case '1' : cout<<"Left, "<<endl;{goto c;}
case 'q' : cout<<"Quit"<<endl;{goto d;}
case 'm' : cout<<"menu\nRight = 0 \nLeft = 1\nQuit = q"<<endl; {goto e;}
default : cout<<"Wrong character!"<<endl;
b: if (r0 != l0){cin>>letter; goto a;}
}
d:
system ("pause");
return 0;
}[/spoiler]
[spoiler]#define DEBUG
#include <iostream>
using namespace std;
#define ASSERT(n)
#define ASSERT(n) \
if(!n) \
{ \
cout<<__TIME__<<endl; \
} \
int main()
{
cout<<"Time: ";
bool flag = 1;
ASSERT (flag != true);
system ("pause");
return 0;
}[/spoiler]
-
C++ is old man. Get with the times. C# is so much prettier.