This the best beginning level C++ project related to Mobile phone. The project is complete implementation of Mobile phone programming. The Mobile phone project consist of 8 modules and these modules are
1. Keypad
2. Calling
3. Messaging
4. Alarm Clock
5. Calculator
6. Profiling
7. Logs
8. Contacts
In starting the program asked user to enter login information and then prompt another option which is menu option. In menu option a user can select his desired option which is related to the upper modules. Here is the source code of this project which help you in better understanding.
Passwords: 1001,1002,1003,1004,1005 with the same Names which mention in Menu.
2. Calling
3. Messaging
4. Alarm Clock
5. Calculator
6. Profiling
7. Logs
8. Contacts
In starting the program asked user to enter login information and then prompt another option which is menu option. In menu option a user can select his desired option which is related to the upper modules. Here is the source code of this project which help you in better understanding.
Passwords: 1001,1002,1003,1004,1005 with the same Names which mention in Menu.
Source Code
#include <iostream> #include <string> #include <conio.h> #include <time.h> #include <fstream> #include <windows.h> #include <cctype> using namespace std; string keypad(); void time(void); void callmenu(); float calculator(double x,double y,char symbol); int menu(); void smsmenu(); void theme(); void password(); void wait( const int &seconds ); void starting (void); int count =0; void readFile(char fileName[],int size); void writeFile(char* fileName,int size,string text); int contact(); void firstMenu(); struct user { string name; string username; string password; string number; }; struct SMS { string from; string to; string text[100]; }; struct Messege { SMS inbox; SMS sentBox; }msg;; struct detail { string from; string to; }; struct Call { detail dailed[100]; detail recived[100]; }call; struct mobile { user contact; Messege msg; Call call; }; Messege message; char* fileName; char* senderName; int check=0; int main() { system("cls"); if(check == 0) { system("color 0a"); } mobile user[6]; user[1].contact.name="Aqib"; user[2].contact.name="Imran"; user[3].contact.name="Noman"; user[4].contact.name="Mehran"; user[5].contact.name="Jibran"; firstMenu(); return 0; } void time(void) { time_t tim; time(&tim); cout <<"TIME: "<< ctime(&tim); return ; } int menu() { Call a; system("cls"); time(); char choice; char ans; string line; ifstream myfile ("menu.txt"); cout<<"\n\n"; if (myfile.is_open()) { while (! myfile.eof() ) { getline (myfile,line,'.'); cout<<line<<endl; } myfile.close(); } else cout << "Unable to open file"; do { choice=getch();; switch(choice) { case '1': { system("cls"); time(); cout<<"\n\n\n\t\t\tWELCOME\n\n"<<endl<<endl; cout<<"\t\t*=============================================*"<<endl <<"\t\t|| __ __ ||"<<endl <<"\t\t|| { /\\ | | | |\\ |[ ||"<<endl <<"\t\t|| {__ /--\\ l__ l__ l | \\|[_& ||"<<endl <<"\t\t|| ||"<<endl <<"\t\t*=============================================*"<<endl; callmenu(); cout<<"\tcalling ...................."<<endl; // all calling featurs break; } case '2': { mobile inbox[1]; system("cls"); time(); cout<<"\n\n\n\t\t\t\tWELCOME \n\n"<<endl<<endl; cout<<"\t\t*================================================*"<<endl <<"\t\t|| __ __ ||"<<endl <<"\t\t|| |__ |\\ /||__ ||"<<endl <<"\t\t|| __| l \\/ l __| ||"<<endl <<"\t\t|| ||"<<endl <<"\t\t*================================================*"<<endl; smsmenu(); count++; break; } case '3': { system("cls"); time(); char back; cout<<"\n\n\n\t\t\t\t\tWELCOME\n\n"<<endl<<endl; cout<<"\t\t*=================================================*"<<endl <<"\t\t| __ __ ___ __ __ |"<<endl <<"\t\t| { /\\ | { | | | /\\ | | | |__| |"<<endl <<"\t\t| {__ /--\\l__ {__ l__l l__ /--\\ l l__l l \\ |"<<endl <<"\t\t| |"<<endl <<"\t\t*=================================================*"<<endl; do{ double x;double y; char symbol; cin>>x>>symbol>>y; cout<<"\n\tyour answer : "<<calculator(x,y,symbol)<<endl<<endl; cout<<"\n\tfor existing calculator press backspace "<<endl; back=getch(); } while (back!=8); break; } case '4': { system("cls"); time(); cout<<"\n\n\n\t\t\t\t\tWELCOME\n\n"<<endl<<endl; cout<<"\t\t*======================================================*"<<endl <<"\t\t| --- __ __ __ |"<<endl <<"\t\t| | |__| |__ |\\ /| |__ |__ |"<<endl <<"\t\t| | | | |__ | \\/ | |__ __| |"<<endl <<"\t\t| |"<<endl <<"\t\t*======================================================*"<<endl; theme(); break; } case '5': { system("cls"); time(); cout<<"\n\n\n"<<endl; contact(); break; } case '6': { int a=5; system("cls"); time(); cout<<"\n\n\n"<<endl; cout<<"\n\n\tYou Are Going To Log Out"<<endl; cout<<"\n\tLoging Out : "; for (int n=0;n<a;n++) { cout<<"."; wait(1); } fileName=0; system("cls"); time(); firstMenu(); } default: { system("cls"); cout<<"\n\n\t\a\a\aYou Enter Wrong Value Try Again .........\n"<<endl; } } cout<<"\n\n\t Press BackSpace For Going To Menu "; do{ ans=getch(); if (ans==8 && ans!=isalpha(ans) && ans!= '@' ) { menu(); } } while(ans!=8); } while (choice!='y' || choice!='Y'); return 0; }//ending the menu functionz void password() { int a=50; do{ time(); int choice; cout<<"\n\n\n\tPlease Enter Your Login Name And Pass : "<<endl<<endl<<endl; choice=contact(); switch (choice) { case 1: { mobile pass; pass.contact.password="1001"; int i=3; string yourpass; do { cout<<"\n\n\tPlease Enter Your Password : "; cin>>yourpass; if (yourpass==pass.contact.password) { char choice; do{ cout<<"\n\tPress 1 For menu "<<endl <<"\n\tPress 2 For Change Pass"<<endl; cin>>choice; switch(choice) { case '1': { system("cls"); menu(); break; } case '2': { cout<<"\n\n\n\tPlease Enter The New Password: "; cin>>pass.contact.password; pass.contact.password=pass.contact.password; break; } default : { cout<<"\n\t\t Try n Again\n"<<endl; } }//ends switch case } while(choice!='-98'); }//ends if of your pass =pass else { i--; cout<<"\n\n\tYou Entered The Wrong Password"<<endl <<"\n\n\tYou Remains "<<i<<" Attempts "<<endl; }//end else of if of your pass= pass } while (i!=0); cout<<"\n\n\n\n\tYou are wrong user try again "<<endl; system("cls"); cout<<"\n\n\t Your Program is Restarting \n\n\n\n"<<endl; wait(2); system("cls"); password(); break; } case 2: { int pass=1002; int i=3; int yourpass; do { cout<<"\n\n\tPlease Enter Your Password : "; cin>>yourpass; if (yourpass==pass) { char choice; cout<<"\n\tPress 1 For menu "<<endl <<"\n\tPress 2 For Change Pass"<<endl; cin>>choice; switch(choice) { case '1': { system("cls"); menu(); break; } case '2': { cout<<"\n\n\n\tPlease Enter The New Password: "; cin>>pass; pass=pass; break; } }//ends switch case }//ends if of your pass =pass else { i--; cout<<"\n\n\tYou Entered The Wrong Password"<<endl <<"\n\n\tYou Remains "<<i<<" Attempts "<<endl; }//end else of if of your pass= pass }while (i!=0); cout<<"\n\n\n\n\tyou are wrong user try again "<<endl; system("cls"); cout<<"\n\n\t your program is restarting \n\n\n\n"<<endl; wait(2); system("cls"); password(); break; } case 3: { int pass=1003; int i=3; int yourpass; do { cout<<"\n\n\tPlease Enter Your Password : "; cin>>yourpass; if (yourpass==pass) { char choice; cout<<"\n\tPress 1 For menu "<<endl <<"\n\tPress 2 For Change Pass"<<endl; cin>>choice; switch(choice) { case '1': { system("cls"); menu(); break; } case '2': { cout<<"\n\n\n\tPlease Enter The New Password: "; cin>>pass; pass=pass; break; } }//ends switch case }//ends if of your pass =pass else { i--; cout<<"\n\n\tYou Entered The Wrong Password"<<endl <<"\n\n\tYou Remains "<<i<<" Attempts "<<endl; }//end else of if of your pass= pass } while (i!=0); cout<<"\n\n\n\n\tyou are wrong user try again "<<endl; system("cls"); cout<<"\n\n\t your program is restarting \n\n\n\n"<<endl; wait(2); system("cls"); password(); break; } case 4: { int pass=1004; int i=3; int yourpass; do { cout<<"\n\n\tPlease Enter Your Password : "; cin>>yourpass; if (yourpass==pass) { char choice; cout<<"\n\tPress 1 For menu "<<endl <<"\n\tPress 2 For Change Pass"<<endl; cin>>choice; switch(choice) { case '1': { system("cls"); menu(); break; } case '2': { cout<<"\n\n\n\tPlease Enter The New Password: "; cin>>pass; pass=pass; break; } }//ends switch case }//ends if of your pass =pass else { i--; cout<<"\n\n\tYou Entered The Wrong Password"<<endl <<"\n\n\tYou Remains "<<i<<" Attempts "<<endl; }//end else of if of your pass= pass } while (i!=0); cout<<"\n\n\n\n\tyou are wrong user try again "<<endl; system("cls"); cout<<"\n\n\t your program is restarting \n\n\n\n"<<endl; wait(2); system("cls"); password(); break; } case 5: { int pass=1005; int i=3; int yourpass; do { cout<<"\n\n\tPlease Enter Your Password : "; cin>>yourpass; if (yourpass==pass) { char choice; cout<<"\n\tPress 1 For menu "<<endl <<"\n\tPress 2 For Change Pass"<<endl; cin>>choice; switch(choice) { case '1': { system("cls"); menu(); break; } case '2': { cout<<"\n\n\n\tPlease Enter The New Password: "; cin>>pass; pass=pass; break; } }//ends switch case }//ends if of your pass =pass else { i--; cout<<"\n\n\tYou Entered The Wrong Password"<<endl <<"\n\n\tYou Remains "<<i<<" Attempts "<<endl; }//end else of if of your pass= pass } while (i!=0); cout<<"\n\n\n\n\tyou are wrong user try again "<<endl; system("cls"); cout<<"\n\n\t your program is restarting \n\n\n\n"<<endl; wait(2); system("cls"); password(); break; } default : { cout<<"\n\n\n\t\aYou Enter The Wrong Name ........"<<endl; cout<<"\n\n\t Try Again .."<<endl; system("pause"); system("cls"); } } }while(a!=-1); } string keypad() { char Messege[1000]={0};; int count=0; char num; int c=0; char counter=0; string ch[]={" 0",".1,;<>?[]{}()+=-_|\\/*","abc2","def3","ghi4","jkl5","mno6","pqrs7","tuv8","wxyz9"}; do{ num=getch(); if (num>=47 && num<=57 || num==8 || num==13) { if (num==8) { cout<<"\b"; cout<<" "; cout<<"\b"; c--; Messege[c]=NULL; } else { if (num=='0') { count=0; do { cout<<ch[0][count]; Messege[c]=ch[0][count]; counter=num;// this counter is saving the previous value num=getch();count ++;//it change the value of the upper count which is breaking the string if (num==counter) { cout<<"\b";//this is using for back space } if(count==ch[0].length()) { count =0; } } while (num==counter); c++; }//if of number 0 else { if (num=='1') { count=0; do { cout<<ch[1][count]; Messege[c]=ch[1][count]; counter=num; num=getch();// this counter is saving the previous value count ++;//it change the value of the upper count which is breaking the string if (num==counter) { cout<<"\b";//this is using for back space } if(count==ch[1].length()) { count =0; } } while (num==counter); c++; }//if of number 1 else { if (num=='2') { count=0; do { cout<<ch[2][count]; Messege[c]=ch[2][count]; counter=num;// this counter is saving the previous value num=getch(); count ++;//it change the value of the upper count which is breaking the string if (num==counter) { cout<<"\b";//this is using for back space } if(count==ch[2].length()) { count =0; } } while (num==counter); c++; }//if of number 2 else { if (num=='3') { count=0; do { cout<<ch[3][count]; Messege[c]=ch[3][count]; counter=num;// this counter is saving the previous value num=getch(); count ++;//it change the value of the upper count which is breaking the string if (num==counter) { cout<<"\b";//this is using for back space } if(count==ch[3].length())//this condion is used for again makin the count to 0 from help of lenght of string { count =0; } } while (num==counter); c++; }//if of number 3 else { if (num=='4') { count=0; do { cout<<ch[4][count]; Messege[c]=ch[4][count]; counter=num;// this counter is saving the previous value num=getch(); count ++;//it change the value of the upper count which is breaking the string if (num==counter) { cout<<"\b";//this is using for back space } if(count==ch[4].length())//this condion is used for again makin the count to 0 from help of lenght of string { count =0; } } while (num==counter); c++; }//if of number 4 else { if (num=='5') { count=0; do { cout<<ch[5][count]; Messege[c]=ch[5][count]; counter=num;// this counter is saving the previous value num=getch(); count ++;//it change the value of the upper count which is breaking the string if (num==counter) { cout<<"\b";//this is using for back space } if(count==ch[5].length())//this condion is used for again makin the count to 0 from help of lenght of string { count =0; } } while (num==counter); c++; }//if of number 5 else { if (num=='6') { count=0; do { cout<<ch[6][count]; Messege[c]=ch[6][count]; counter=num;;// this counter is saving the previous value num=getch(); count ++;//it change the value of the upper count which is breaking the string if (num==counter) { cout<<"\b";//this is using for back space } if(count==ch[6].length())//this condion is used for again making the count to 0 from help of lenght of string { count =0; } } while (num==counter); c++; }//if of number 6 else { if (num=='7') { count=0; do { cout<<ch[7][count]; Messege[c]=ch[7][count]; counter=num;;// this counter is saving the previous value num=getch(); count ++;//it change the value of the upper count which is breaking the string if (num==counter) { cout<<"\b";//this is using for back space } if(count==ch[7].length())//this condion is used for again makin the count to 0 from help of lenght of string { count =0; } } while (num==counter); c++; }//if of number 7 else { if (num=='8') { count=0; do { cout<<ch[8][count]; Messege[c]=ch[8][count]; counter=num;// this counter is saving the previous value num=getch(); count ++;//it change the value of the upper count which is breaking the string if (num==counter) { cout<<"\b";//this is using for back space } if(count==ch[8].length())//this condion is used for again makin the count to 0 from help of lenght of string { count =0; } } while (num==counter); c++; }//if of number 8 else { if (num=='9') { count=0; do { cout<<ch[9][count]; Messege[c]=ch[9][count]; counter=num;// this counter is saving the previous value num=getch(); count ++;//it change the value of the upper count which is breaking the string if (num==counter) { cout<<"\b";//this is using for back space } if(count==ch[9].length())//this condion is used for again makin the count to 0 from help of lenght of string { count =0; } } while (num==counter); c++; }//ends if of number 9 }//ends else of number 8 }//ends else of number 7 }//ends else of number 6 }//ends else of number 5 }//ends else of number 4 }//ends else of number 3 }//ends else of number 2 }//ends else of number 1 }//ends else of number 0 }//ends else of num==8 yani back space }//ends if of not working keyboard } while (num!=13); user send[100]; cout<<endl; string name; name=Messege; return name; }//ending the function of keypad char ans; int counti=0; void smsmenu() { int a; string sms; cout<<"\n\n\t\t1. Write SMS "<<endl <<"\n\t\t2. Inbox "<<endl <<"\n\t\t3. Sentbox "<<endl; cout<<"\n\t\tPress Backspace For Going to Menu"<<endl; char choice; choice=getch(); switch(choice) { case '1': { system("cls"); time(); cout<<"\n\n\t\tWrite The Text SMS \n\n "<<endl; sms=keypad(); int size=50; char* real; real = fileName; writeFile(fileName,size,sms); a=contact(); writeFile(fileName,size,sms);//text=name; fileName = real; break; } case '2': { system("cls"); time(); cout<<"\n\t\tBackspace to SMS Menu"<<endl; cout<<"\n\n\t\tInBox "<<endl; // readFile(fileName,50); for(int i =0; i< counti; i++) { cout<<msg.inbox.text[i]; }//end for ans=getch(); if (ans==8) { system("cls"); smsmenu(); } // readFile(); break; } case '3': { system("cls"); time(); cout<<"\n\t\tBackspace to SMS Menu"<<endl; cout<<"\n\n\t\tSentBox "<<endl; //readFile(fileName,50); for(int j =0; j< counti; j++) { cout<<msg.sentBox.text[j]; }//end for ans=getch(); if (ans==8) { system("cls"); smsmenu(); } break; } case 8: { system("cls"); menu(); } default: { cout<<"\n\n\t\tTry Again"<<endl; } } } void callmenu() { cout<<"\n\n\t\t1. Make Call"<<endl <<"\n\t\t2. Recived Call "<<endl <<"\n\t\t3. Dailed Call "<<endl; cout<<"\n\t\tPress Backspace For Going to Menu"<<endl; char choice; choice=getch(); switch(choice) { case '1': { system("cls"); time(); cout<<"\n\n\t\tMake Call \n\n "<<endl; contact(); break; } case '2': { system("cls"); time(); cout<<"\n\t\tBackspace to Call Menu"<<endl; cout<<"\n\n\t\tRecived Call "<<endl; for(int j =0; j< counti; j++) { cout<<call.dailed[counti].from; } ans=getch(); if (ans==8) { system("cls"); callmenu(); } break; } case '3': { system("cls"); time(); cout<<"\n\t\tBackspace to Call Menu"<<endl; cout<<"\n\n\t\tDailed Call "<<endl; for(int j =0; j< counti; j++) { cout<<call.recived[counti].to; } ans=getch(); if (ans==8) { system("cls"); callmenu(); } break; } case 8: { system("cls"); menu(); } default: { cout<<"\n\n\t\tTry Again"<<endl; } } } void readFile(char* fileName,int size) { int counter=0; ifstream myfile (fileName); string line; if (myfile.is_open()) { while (! myfile.eof() ) { getline (myfile,line); if(line=="*") counter++; if (line!="*" && counter==1) { msg.inbox.text[counti]=line; } else { if (line!="*" && counter==2) { msg.sentBox.text[counti]=line; } else { if (line!="*" && counter==3) { call.dailed[counti].to=line; } else { if (line!="*" && counter==4) { call.recived[counti].from=line; } } } } counti ++; } myfile.close(); } else { cout << "Unable to open file"; } } void writeFile(char* fileName,int size,string text) { ofstream myfile (fileName,ios::app); myfile <<text<<endl;// "Writing this to a file.\n"; myfile.close(); } float calculator(double x,double y,char symbol) { string E= "error" ; double result; switch (symbol) { case '+': { result=x+y; break; } case '-': { result=x-y; break; } case '*': { result=x*y; break; } case '/': { if (y!=0) { result=x/y; cout<<result; break; } else { return 'E'; } } default: { cout<<"\n\n\t try a good symbol ......"<<endl; } } return result; }//ending the calcultor function void wait( const int &seconds ) { clock_t endwait; // Type needed to compare with clock() endwait = clock() + ( seconds * CLOCKS_PER_SEC ); while( clock() < endwait ) {} // Nothing need be done here. } void starting (void) { int a=5; cout<<endl; cout<<"\t Loading "; for(int i=0; i<a;i++) { cout<<"."; wait(1); } system("cls"); time(); cout<<"\n\n\n\n\t|=============================================================+"<<endl <<"\t| __ __ __ __ |"<<endl <<"\t|***********\\ /\\ / [__ | | | | ||\\ /||__***********|"<<endl <<"\t| \\/ \\/ [__ |__ |__ |__ |__|l \\/ l|__ |"<<endl <<"\t| |"<<endl <<"\t|=============================================================+"<<endl; wait(3); } int contact() { int size=50; int c;//c is returning index value int i=0; string name1; mobile user[6]; user[1].contact.name="Aqib"; user[2].contact.name="Imran"; user[3].contact.name="Noman"; user[4].contact.name="Mehran"; user[5].contact.name="Jibran"; for (int j=1;j<6;j++) { cout<<"\t"<<user[j].contact.name<<endl; } cout<<"\n\n\t>> "; cin>>name1; //cout<<name1; for (i=1;i<6;i++) { if (user[i].contact.name==name1) { if(name1=="Aqib") { senderName="Aqib"; fileName = "aqib.txt"; readFile(fileName, size); }//passing file name instance Aqib.txt else { if(name1=="Imran") { senderName="Imran"; fileName = "imran.txt"; readFile(fileName, size); }//passing file name instance Imran.txt else { if(name1=="Noman") { senderName="Noman"; fileName = "noman.txt"; readFile(fileName, size); }//passing file name instance Noman.txt else { if(name1=="Mehran") { senderName="mehran"; fileName = "mehran.txt"; readFile(fileName, size); }//passing file name instance mehran.txt else { if(name1=="Jibran") { senderName="Jibran"; fileName = "jibran.txt"; readFile(fileName, size); }//passing file name instance jibran.txt }//else of if(name1=="Mehran") }//else of if(name1=="Noman") }//else of if(name1=="Imran") }//else of if(name1=="Aqib") c=i;//this c is returning the index of the logon user }//eds if (user[i].contact.name==name1) }//ends for (i=1;i<6;i++) return c; }//ends function int contact() void theme() { cout<<"\n\n\t\t Changing Color \n\n\n"; cout<<"\n\t\tPress 1 for Blue "<<endl <<"\n\t\tPress 2 for Gray "<<endl <<"\n\t\tPress 3 for Red "<<endl <<"\n\t\tPress 4 for white "<<endl <<"\n\t\tPress 5 for Green "<<endl <<"\n\t\tPress 6 for purple "<<endl <<"\n\t\tPress 7 for Aqua "<<endl <<"\n\t\tPress 8 for Black "<<endl <<"\n\t\tPress 9 for Yellow "<<endl <<"\n\t\tPress 10 for Reset "<<endl; int ch; cin>>ch; switch(ch) { case 1: system("color 9b"); check = 1; break; case 2: system("color 8c"); check = 1; break; case 3: system("color 4a"); check = 1; break; case 4: system("color 78"); check = 1; break; case 5: system("color a0"); check = 1; break; case 6: system("color 51"); check = 1; break; case 7: system("color 38"); check = 1; break; case 8: system("color 0f"); check = 1; break; case 9: system("color e0"); check = 1; break; case 10: system("color f0"); check = 0;; break; } } void firstMenu() { starting(); char choise=0; system("cls"); time(); cout<<"\n\n\t\tEnter 1 for Login "<<endl <<"\n\t\tEnter 2 for Exit "<<endl; cin>>choise; switch (choise) { case '1': system("cls"); time(); password(); break; case '2': cout<<"\n\t\t(------------------GOOD BYE------------------)";cout<<endl<<endl; exit(0); break; default: cout<<"\n\n\t\tError.....\n\nWrong Entry "<<endl; system("pause"); firstMenu(); } }
Output of the Program
Mobile Phone Programming Project in C++ |
Mobile Phone Programming Project in C++ Menu Module |
Mobile Phone Programming Project in C++ SMS Module |
Mobile Phone Programming Project in C++ Themes Module |
0 comments:
Post a Comment