help me see my program.... cannot run propertly.............
<code>
#include<iostream.h>
#include<ctype.h>
#include<fstream.h>
#include<string.h>
#include<iomanip.h>
#include<stdlib.h>
#include<conio.h>
#include<windows.h>
#include<stdio.h>
#include <time.h>
class String
{
int size;
int len;
char *codetable;
char text[200];
char *enc;
char *dec;
public:
String(char *b)
{
len=strlen(b)+1;
codetable=new char[len];
strcpy(codetable,b);
}
void setstring(char *c);
void encode(void);
void menu(void);
void decode(void);
};
void String::setstring(char *c)
{
len=strlen(c)+1;
codetable=new char[len];
strcpy(codetable,c);
}
void String::encode(void)
{
system("cls");
int x,y;
char ans;
//char name[20];
cout<<"\n\n\nPlease Enter The Message:"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cin.ignore();
cin.getline(text,200);
size=strlen(text);
enc=new char[size+1];
enc[size]='\0';
for(x=0;x<size;x++)
{
for(y=0;y<len;y=y+1)
{
if(text[x]==codetable[y])
{
enc[x]=codetable[y+1];
}
}
}
cout<<"\n\n\n\nThe Message After Encode:"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<enc<<endl;
cout<<"\n\n\nPress one character to continue: ";
cin>>ans;
/*cout<<"\n\n\n\nEnter file name(a:file name.dat):";
cin.getline(name,20);
ofstream sfile;
sfile.open(name);
sfile<<enc;
sfile.close();
system("cls");*/
menu();
}
void String::menu()
{
char choice='X',*dateString;
do
{
time_t currentTime;
currentTime = time(NULL);
dateString = ctime(¤tTime);
system("CLS");
cout <<"\n\n\n\t\t\t [Encode Menu]\n";
cout <<"\n\t\t\t Today is ";
//displays todays date from time string;
for (int i=0;i<10;i++)cout <<dateString[i];
cout <<" ";
for (i=20;i<24;i++)cout <<dateString[i];
cout <<"\n\n\t\t ";
cout <<"\n\t\t [1] Encode String ";
cout <<"\n\t\t ";
cout <<"\n\t\t [2] Decode String ";
cout <<"\n\t\t ";
cout <<"\n\t\t [3] Translation Table ";
cout <<"\n\t\t ";
cout <<"\n\t\t [4] Exit ";
cout <<"\n\t\t ";
cout <<"\n\n\n\n\n\t\t Type in a selection from [1] to [4]: ";
cin >>(choice);
switch (choice)
{
case '1':encode();
break;
case '2':decode();
break;
case '3'://editData();
break;
case '4':system("cls"); cout <<"\n\t Exiting program......";
break;
default: system("CLS");cout << "Invalid Selection";
}
}while (choice != '4');
}
void String::decode(void)
{
int x,y;
char ans;
system("cls");
cout<<"\n\n\nThe Message Before Decode: "<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<enc<<endl;
dec=new char[size+1];
dec[size]='\0';
for (x=0;x<size;x++)
{
for (y=0;y<len;y++)
{
if(enc[x]==codetable[y])
dec[x]=codetable[y-1];
}
}
cout<<"\n\n\n\nThe Message After Decode:"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<dec<<endl;
cout<<"\n\n\n\n\nPress one character to continue: ";
cin>>ans;
}
void main()
{
String table("qazwsxedcrfvtgbyhnujmikolpOPLIKUJMYHNTGBRFV EDCWSXQAZ1!2@3#4$5%6^7&8*9(0)-_=+,.< >?:;'{}[]|/È");
String table("");
table.setstring(adidas);
table.menu();
}
</code>