Code:
#include<iostream>
#include <math.h>
#include <windows.h> // For Sleep function
#include <ctime> // For Displaying time
#include <iomanip>
#include <limits>
#include <conio.h>
#include <stdlib.h>
#include <fstream>
#include <ctype.h> // For isalpha() function
using namespace std;
void taxcalc();
void calcultor();
void time();
void loading();
void menu();
void mainEntrance();
//void call();
void mainmenu();
void login();
void time()
{
// FOR current time and date
//
time_t now;
time (&now);
cout << "\n\n\t\t Current Date & Time is: "<<ctime(&now);; // For Displaying Date and Time
// Creating Object of Time
}
void loading()
{
//(24,26);
int i;
for (i=0; i<5; i++)
{
cout << "\xdb\xdb\xdb\xdb\xdb";
Sleep(100);
}
Sleep(500);
cout << endl << endl;
//(24,28);
}
void mainEntrance()
{
//(15,2);
cout<<"\tÛÛÛÛÛ \t\t\tÛÛÛÛÛÛÛÛ \tÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "<<endl;
cout<<"\t ÛÛÛ \t\t\tÛÛÛ ÛÛ\tÛÛÛ ÛÛ "<<endl;
cout<<"\t ÛÛÛ \t\t\tÛÛÛ \tÛÛÛ "<<endl;
cout<<"\t ÛÛÛ \t\t\tÛÛÛÛÛÛÛÛ \tÛÛÛ "<<endl;
cout<<"\t ÛÛÛ \t\t\tÛÛÛ \tÛÛÛ "<<endl;
cout<<"\t ÛÛÛ \t\t\tÛÛÛ \tÛÛÛ "<<endl;
cout<<"\tÛÛÛÛÛÛÛÛÛÛÛÛ \t\tÛÛÛÛÛÛÛÛ \tÛÛÛ "<<endl<<endl;
cout << " **************************************************************" << endl;
cout << " ma first applications " << endl;
cout << " **************************************************************" << endl;
}
void login()
{
system("cls");
string username = "";
string password = "";
char ch,ch2,retry;
int i = 0, j = 0;
mainEntrance();
time();
cout << "(LOGIN)";
cout << "\n\n\t\tEnter Username: \t\t Enter Password: ";
cout<<endl;
ch2=getch();
while(ch2 != 13){ // gets input until 'Enter' key is pressed
if(ch2 == '\b'){
if(username.size() > 0 ) {
username.erase(username.begin() + username.size() -1);
cout << "\b \b";
j--;
}
ch2 = getch();
}
else{
if(j<10)
{
cout << ch2;
username.push_back(ch2);
ch2 = getch();
j++;
}
else{
ch2 = getch();
}
}
}
ch=getch();
cout<<endl;
while(ch != 13){ // gets input until 'Enter' key is pressed
if(ch == '\b'){
if(password.size() > 0){
password.erase(password.begin() + password.size() -1);
cout << "\b \b";
i--;
}
ch = getch();
}
else{
if(i<10)
{
password.push_back(ch);
cout << "*"; // For showing stars instead of actual alphabets
ch = getch();
i++;
}
else{
ch = getch();
}
}
}
if (username == "letarik" && password == "1012")
{
//(15,16);
cout << "\n\n Username & Password Matched !! ";
cout << "\n\n\t Access Granted...\n\n";
cout << "\n\n\t\t Now Loading: ";
loading();
return;
}
else
{
system("cls");
cout << "\n\n You entered Wrong UserName/Password ";
cout << "\n\n\t Press 'R' or 'r' to Enter Again OR any other key to exit ...\n\n";
cin >> retry;
if(retry == 'r' || retry == 'R')
{
system("cls");
login();
}
else
{
exit(0);
}
}
}
void menu()
{
cout<<"\n\t\tchose what u want to do\n\n";
cout<<"\t\tenter ur choice(integer 1-11) \n\n";
cout<<"\t\t--------- Welcome ---------\n";
cout<<"\t\t1---------> simple calculator\n";
cout<<"\t\t2---------> simple tax calc\n";
//cout<<"\t\t3---------> super mrkt billing app calc\n";
cout<<"\t\t4---------> main manu\n";
cout<<"\t\t5---------> exit app\n";
int x;
cin>>x;
switch(x)
{
case 4:
mainmenu();
system("pause");
break;
case 5:
exit(0);
break;
default:
cout << "\n\n Please Enter a valid Choice: \n\n";
system ("pause");
break;
}
}
void mainmenu()
{
menu();
}
int main()
{
system("color 0D");
login();
while(true)
{
system("cls");
mainmenu();
menu();
}
return 1;
}
Last edited by a moderator: