باگ های این برنامه رو به من بگید !
با سلام خدمت دوستان من یه برنامه دفترچه تلفن نوشتم با امکان ذخیره دائم اطلاعات. می خواستم شما بیایید و باگ های این برنامه رو به من بگید . کد :
کد:
#include <iostream>
#include <string.h>
#include <fstream>
#include <conio.h>
using namespace std;
const int NameSize=40;
char Name[NameSize];
string FirstName;
string LastName;
string Telephone;
string Mobile;
string Address;
string FirstName2;
string LastName2;
string Telephone2;
string Mobile2;
string Address2;
void QuestionForm (int);
void SaveDataBase();
void ImportDataBase(char DBName[]);
void AboutDisplayMassage();
int main () {
int ResumeProgram=true;
while (ResumeProgram) {
int answer;
system("cls");
cout<<"\n\n\n\n\n\n";
cout<<" ____________________________ "<<endl;
cout<<" | | "<<endl;
cout<<" | ++ Welcome ++ | "<<endl;
cout<<" | | "<<endl;
cout<<" | ++ Select a modify ++ | "<<endl;
cout<<" | | "<<endl;
cout<<" | 1.Enter Data | "<<endl;
cout<<" | | "<<endl;
cout<<" | 2.Import Data | "<<endl;
cout<<" | | "<<endl;
cout<<" | 3.About | "<<endl;
cout<<" | | "<<endl;
cout<<" | 4.Quit | "<<endl;
cout<<" |____________________________| "<<endl;
cout<<" ";
cin>>answer;
switch (answer) {
case 1 :
QuestionForm(1);
break;
case 2 :
QuestionForm(2);
break;
case 3 :
AboutDisplayMassage();
break;
case 4 :
ResumeProgram=false;
getch();
break;
default :
break;}}
return 0;}
void QuestionForm (int modify){
if (modify==1){
system("cls");
cout<<"\n\n\n\n\n\n";
cout<<" Enter DataBase Name : ";
cin>>Name;
system("cls");
cout<<"\n";
cout<<"\nFirst Name : ";
cin.sync();
getline(cin,FirstName2);
cout<<"\nLast Name : ";
getline(cin,LastName2);
cout<<"\nTelephone Number : ";
getline(cin,Telephone2);
cout<<"\nMoblie Number : ";
getline(cin,Mobile2);
cout<<"\nAddress : ";
getline(cin,Address2);
FirstName="FirstName : "+FirstName2;
LastName="LastName : "+LastName2;
Telephone="Telephone Number : "+Telephone2;
Mobile="Mobile Number : "+Mobile2;
Address="Address : "+Address2;
SaveDataBase();}
else {
system("cls");
cout<<"\n\n\n\n\n\n";
cout<<" Enter DataBase Name : ";
cin>>Name;
system("cls");
ImportDataBase(Name);}
}
void SaveDataBase(){
ofstream DB;
DB.open(Name);
DB<<FirstName<<"\n\n"<<LastName<<"\n\n"<<Telephone<<"\n\n"<<Mobile<<"\n\n"<<Address;
DB.close();
cout<<"\n\nThe Datas has been saved !...";
getch();}
void ImportDataBase(char DBName[]){
string Buffer;
ifstream myDB (DBName);
if (myDB.is_open())
{
while (! myDB.eof() )
{
getline (myDB,Buffer);
cout << Buffer<<endl;
}
myDB.close();
getch();
}
else cout << "Unable to open file";
getch();}
void AboutDisplayMassage() {
system("cls");
cout<<"\n\n\n\n";
cout<<" ____________________________ "<<endl;
cout<<" | | "<<endl;
cout<<" | This Program | "<<endl;
cout<<" | | "<<endl;
cout<<" | Writed by C++ in | "<<endl;
cout<<" | | "<<endl;
cout<<" | Agust 2008 - 1387 H.SH | "<<endl;
cout<<" | | "<<endl;
cout<<" | If you find a bug in this | "<<endl;
cout<<" | Call with this E-Mail : | "<<endl;
cout<<" | Hosein1986@Hotmail.com | "<<endl;
cout<<" |____________________________| "<<endl;
getch();}