mansuetoraph
Fanatic
mga ka phc patulong ako sa code ko. dapat pag nag enter sya ng maling password 3x exit ang program at kapag tama naenter nya proceed to next command dapat.
#include<iostream>
#include<windows.h>
#include<stdlib.h>
#include<iomanip>
#include<conio.h>
using namespace std;
int addition (int a, int b)
{
int c;
c=a+b;
return c;
}
int subtraction (int a, int b)
{
int d;
d= a-b;
return d;
}
int multiplication (int a, int b)
{
int e;
e = a*b;
return e;}
int division (int a, int b)
{
int f;
f = a/b;
return f;
}
int subjectEncode()
{
cout<<"VED = Values Education"<<"\nEng = ENGLISH"<<"\nPhl = Philosophy"<<"\nFEE = Fundamentals in Electronics and Electricity";
cout<<"\nPE = Physical Education"<<"\nProg = Computer Programming";
string subjectCode,subject;
cout<<"\n\n\t\tENTER SUBJECT CODE: ";
cin>>subjectCode;
if(subjectCode=="Eng")
{
subject="\tENGLISH";
cout<<subject;
Sleep (1500);
system("cls");
return 0;
}
else if(subjectCode=="VED")
{
subject="\tValues Education";
cout<<subject;
Sleep (1500);
system("cls");
return 0;
}
else if(subjectCode=="Phl")
{
subject="\tPhilosophy";
cout<<subject;
Sleep (1500);
system("cls");
return 0;
}
else if(subjectCode=="FEE")
{
subject="\tFundamentals in Electronics and Electricity";
cout<<subject;
Sleep (1500);
system("cls");
return 0;
}
else if(subjectCode=="PE")
{
subject="\tPhysical Education";
cout<<subject;
Sleep (1500);
system("cls");
return 0;
}
else if (subjectCode=="Prog")
{
subject="\tComputer Programming";
cout<<subject;
Sleep (1500);
system("cls");
return 0;
}
else
{
cout<<"\t\tInvalid Input!";
Sleep (1500);
system("cls");
return 0;
}
}
int transportationMatrix()
{
int passenger,totalFare,fare,dCode;
do
{
cout<<"\t1. Pasig - Crossing (P10.00)"<<"\n\t2. Pasig - Kalentong (P16.00)"<<"\n\t3. Pasig - Quiapo (P25.00)";
cout<<"\n\t4. Pasig - Ligaya (P11.00)"<<"\n\t5. Pasig - Marikina (P15.00)";
int passenger,totalFare,fare,dCode;
cout<<"\n\nNumber of Passengers: ";
cin>>passenger;
cout<<"Enter Destination Code: ";
cin>>dCode;
if(dCode==1)
{
cout<<"Pasig - Crossing (P10.00)";
fare=10;
totalFare=passenger*fare;
cout<<"\nTotal Fare: ";
cout<<totalFare;
Sleep(1500);
system("cls");
}
else if (dCode==2)
{
cout<<"Pasig - Kalentong (P16.00)";
fare=16;
totalFare=passenger*fare;
cout<<"\nTotal Fare: ";
cout<<totalFare;
Sleep(1500);
system("cls");
}
else if(dCode==3)
{
cout<<"Pasig - Quiapo (P25.00)";
fare=25;
totalFare=passenger*fare;
cout<<"\nTotal Fare: ";
cout<<totalFare;
Sleep(1500);
system("cls");
}
else if (dCode==4)
{
cout<<"Pasig - Ligaya (P11.00)";
fare=11;
totalFare=passenger*fare;
cout<<"\nTotal Fare: ";
cout<<totalFare;
Sleep(1500);
system("cls");
}
else if (dCode==5)
{
cout<<"Pasig - Marikina (P15.00)";
fare=15;
totalFare=passenger*fare;
cout<<"\nTotal Fare: ";
cout<<totalFare;
Sleep(1500);
system("cls");
}
else
{
cout<<"\tInvalid Input!";
Sleep(1500);
system("cls");
return 0;
}
}while(dCode!=6);
return 0;
}
int conversion()
{
float ft, inch, cm, yard, metre;
cout<<"Enter the Feet: ";
cin>>ft;
inch = ft*12;
cm = ft*30.48;
yard = ft*0.333333;
metre = ft*0.3048;
cout<<"\n----------CONVERSION------------\n";
cout<<endl;
cout<<"Feet to Inches: ";
cout<<inch;
cout<<endl;
cout<<"Feet to Centimeter: ";
cout<<cm;
cout<<endl;
cout<<"Feet to Yard: ";
cout<<yard;
cout<<endl;
cout<<"Feet to Meter: ";
cout<<metre;
}
int payroll()
{
string name;
do
{
float nhw, rph, bp, sss, medicare, totalDeduction,grosspay;
cout<<"\t\t\tSCAMMAZ INTERNATIONAL INC.\n";
cout<<"\t\t565 Pacencia Cruz Compund Jenny's Avenue, Maybunga, Pasig";
cout<<endl;
cout<<endl;
cout<<"Name of Employee: ";
cin>>name;
getline(cin, name);
cout<<"Number of hours worked: ";
cin>>nhw;
cout<<"Rate per hour: ";
cin>>rph;
bp= nhw*rph;
cout<<"Basic Pay: ";
cout<<bp;
cout<<endl;
cout<<endl;
cout<<"DEDUCTIONS";
cout<<endl;
cout<<endl;
cout<<"SSS: ";
cin>>sss;
cout<<"Medicare: ";
cin>>medicare;
totalDeduction = sss+medicare;
cout<<"Total Deduction: ";
cout<<totalDeduction;
grosspay= bp-totalDeduction;
cout<<endl;
cout<<endl;
cout<<"Gross Pay is: ";
cout<<grosspay;
Sleep(2000);
system("cls");
}while (name !="Lol" );
}
int function()
{
int ans,x,y,code;
do
{
cout<<"\n\n\t\t<<MAIN MENU>>";
cout<<"\n\t\t1. Addition";
cout<<"\n\t\t2. Subtraction";
cout<<"\n\t\t3. Multiplication";
cout<<"\n\t\t4. Division";
cout<<"\n\nEnter First Number: ";
cin>>x;
cout<<"\nEnter Second Number: ";
cin>>y;
cout<<"\nEnter Code: ";
cin>>code;
if (code == 1)
{
ans=addition(x,y);
cout<<"\nThe sum is "<<ans;
Sleep(1500);
}
else if (code == 2)
{
ans=subtraction(x,y);
cout<<"\nThe difference is "<<ans;
Sleep(1500);
}
else if (code == 3)
{
ans=multiplication(x,y);
cout<<"\nThe product is "<<ans;
Sleep(1500);
}
else if (code == 4)
{
ans=division(x,y);
cout<<"\nThe quotient is "<<ans;
Sleep(1500);
}
system("cls");
} while (ans!=5);
}
int prog3()
{
int array [99999];
int num,a,i,j,temp;
int total = 0;
cout<<"Enter number of array: ";
cin>>num;
cout<<"\n";
for (a=0;a<num;a++)
{
cin>>array[a];
}
cout<<"\n";
for (a=0;a<num;a++)
{
cout<<array[a]<<" ";
total+=array[a];
}
cout<<"\n\nTotal is: "<<total;
for (i=0;i<num;i++)
{
for (j=0;j<num-i-1;j++)
{
if (array[j]>array[j+1])
{
temp=array[j];
array[j]=array[j+1];
array [j+1]=temp;
}
}
}
cout<<"\n\nSorted Array: ";
for (a=0;a<num;a++)
{
cout<<" "<<array[a];
}
}
int MultiplicationTable()
{
int a, b, x, y;
cout<<"Input Column: ";
cin>>x;
cout<<"Input Row: ";
cin>>y;
cout<<endl<<endl;
for (a=1; a<=x; a++)
{
for (b=1; b<=y; b++)
{
cout<<a*b<<"\t";
}
cout<<endl;
}
getch();
return 0;
}
int main()
{
string username;
int choice;
int attemptCount = 0;
string pass2="polbos322";
string setUser = "REYJAN";
//for (attemptCount = 0; attemptCount <3; attemptCount++)
//{
cout<<"Enter Username: ";
cin>>username;
cout<<"Enter Password: ";
char password[30];
int x=0;
char z;
for (x=0;
{
z = getch();
if ((z>='a' && z<='z') || (z>='A' && z<='Z') || (z>='0' && z<='9'))
{
password[x]=z;
x++;
cout<<"*";
}
if (z=='\b' && x>=1)
{
cout<<"\b \b";
x--;
}
if (z=='\r')
{
password[x]='\0';
break;
}
}
if (password == pass2 && username==setUser)
{
cout<<"\n\n\t\tLogin Successful"<<"\n"<<endl;
Sleep(1000);
system("cls");
}
else
{
cout<<"\n\n\tIncorrect username/password!"<<"\n"<<endl;
return 0;
}
//}
system("cls");
do
{
cout<<"\n\t\tMAIN MENU"<<"\n\t1. Payroll"<<"\n\t2. Transportation Matrix"<<"\n\t3. Conversion"<<"\n\t4. Subject Encoding";
cout<<"\n\t5. Adding & Sorting Entered Arrays"<<"\n\t6. Finding Sum, Difference, Product & Qoutient using function";
cout<<"\n\t7. Multiplication Table";
cout<<"\n\n\tEnter Your Choice: ";
cin>>choice;
system("cls");
if (choice == 1)
{
cout<<payroll();
Sleep(2000);
}
else if (choice == 2)
{
cout<<transportationMatrix();
Sleep(2000);
}
else if (choice == 3)
{
cout<<conversion();
Sleep(2000);
}
else if (choice == 4)
{
cout<<subjectEncode();
Sleep(2000);
}
else if (choice == 5)
{
cout<<prog3();
Sleep(2000);
}
else if (choice == 6)
{
cout<<function();
Sleep(2000);
}
else if (choice == 7)
{
cout<<MultiplicationTable();
Sleep(2000);
}
system("cls");
}
while (choice<8);
cout<<"\tInvalid Input";
return 0;
}
#include<iostream>
#include<windows.h>
#include<stdlib.h>
#include<iomanip>
#include<conio.h>
using namespace std;
int addition (int a, int b)
{
int c;
c=a+b;
return c;
}
int subtraction (int a, int b)
{
int d;
d= a-b;
return d;
}
int multiplication (int a, int b)
{
int e;
e = a*b;
return e;}
int division (int a, int b)
{
int f;
f = a/b;
return f;
}
int subjectEncode()
{
cout<<"VED = Values Education"<<"\nEng = ENGLISH"<<"\nPhl = Philosophy"<<"\nFEE = Fundamentals in Electronics and Electricity";
cout<<"\nPE = Physical Education"<<"\nProg = Computer Programming";
string subjectCode,subject;
cout<<"\n\n\t\tENTER SUBJECT CODE: ";
cin>>subjectCode;
if(subjectCode=="Eng")
{
subject="\tENGLISH";
cout<<subject;
Sleep (1500);
system("cls");
return 0;
}
else if(subjectCode=="VED")
{
subject="\tValues Education";
cout<<subject;
Sleep (1500);
system("cls");
return 0;
}
else if(subjectCode=="Phl")
{
subject="\tPhilosophy";
cout<<subject;
Sleep (1500);
system("cls");
return 0;
}
else if(subjectCode=="FEE")
{
subject="\tFundamentals in Electronics and Electricity";
cout<<subject;
Sleep (1500);
system("cls");
return 0;
}
else if(subjectCode=="PE")
{
subject="\tPhysical Education";
cout<<subject;
Sleep (1500);
system("cls");
return 0;
}
else if (subjectCode=="Prog")
{
subject="\tComputer Programming";
cout<<subject;
Sleep (1500);
system("cls");
return 0;
}
else
{
cout<<"\t\tInvalid Input!";
Sleep (1500);
system("cls");
return 0;
}
}
int transportationMatrix()
{
int passenger,totalFare,fare,dCode;
do
{
cout<<"\t1. Pasig - Crossing (P10.00)"<<"\n\t2. Pasig - Kalentong (P16.00)"<<"\n\t3. Pasig - Quiapo (P25.00)";
cout<<"\n\t4. Pasig - Ligaya (P11.00)"<<"\n\t5. Pasig - Marikina (P15.00)";
int passenger,totalFare,fare,dCode;
cout<<"\n\nNumber of Passengers: ";
cin>>passenger;
cout<<"Enter Destination Code: ";
cin>>dCode;
if(dCode==1)
{
cout<<"Pasig - Crossing (P10.00)";
fare=10;
totalFare=passenger*fare;
cout<<"\nTotal Fare: ";
cout<<totalFare;
Sleep(1500);
system("cls");
}
else if (dCode==2)
{
cout<<"Pasig - Kalentong (P16.00)";
fare=16;
totalFare=passenger*fare;
cout<<"\nTotal Fare: ";
cout<<totalFare;
Sleep(1500);
system("cls");
}
else if(dCode==3)
{
cout<<"Pasig - Quiapo (P25.00)";
fare=25;
totalFare=passenger*fare;
cout<<"\nTotal Fare: ";
cout<<totalFare;
Sleep(1500);
system("cls");
}
else if (dCode==4)
{
cout<<"Pasig - Ligaya (P11.00)";
fare=11;
totalFare=passenger*fare;
cout<<"\nTotal Fare: ";
cout<<totalFare;
Sleep(1500);
system("cls");
}
else if (dCode==5)
{
cout<<"Pasig - Marikina (P15.00)";
fare=15;
totalFare=passenger*fare;
cout<<"\nTotal Fare: ";
cout<<totalFare;
Sleep(1500);
system("cls");
}
else
{
cout<<"\tInvalid Input!";
Sleep(1500);
system("cls");
return 0;
}
}while(dCode!=6);
return 0;
}
int conversion()
{
float ft, inch, cm, yard, metre;
cout<<"Enter the Feet: ";
cin>>ft;
inch = ft*12;
cm = ft*30.48;
yard = ft*0.333333;
metre = ft*0.3048;
cout<<"\n----------CONVERSION------------\n";
cout<<endl;
cout<<"Feet to Inches: ";
cout<<inch;
cout<<endl;
cout<<"Feet to Centimeter: ";
cout<<cm;
cout<<endl;
cout<<"Feet to Yard: ";
cout<<yard;
cout<<endl;
cout<<"Feet to Meter: ";
cout<<metre;
}
int payroll()
{
string name;
do
{
float nhw, rph, bp, sss, medicare, totalDeduction,grosspay;
cout<<"\t\t\tSCAMMAZ INTERNATIONAL INC.\n";
cout<<"\t\t565 Pacencia Cruz Compund Jenny's Avenue, Maybunga, Pasig";
cout<<endl;
cout<<endl;
cout<<"Name of Employee: ";
cin>>name;
getline(cin, name);
cout<<"Number of hours worked: ";
cin>>nhw;
cout<<"Rate per hour: ";
cin>>rph;
bp= nhw*rph;
cout<<"Basic Pay: ";
cout<<bp;
cout<<endl;
cout<<endl;
cout<<"DEDUCTIONS";
cout<<endl;
cout<<endl;
cout<<"SSS: ";
cin>>sss;
cout<<"Medicare: ";
cin>>medicare;
totalDeduction = sss+medicare;
cout<<"Total Deduction: ";
cout<<totalDeduction;
grosspay= bp-totalDeduction;
cout<<endl;
cout<<endl;
cout<<"Gross Pay is: ";
cout<<grosspay;
Sleep(2000);
system("cls");
}while (name !="Lol" );
}
int function()
{
int ans,x,y,code;
do
{
cout<<"\n\n\t\t<<MAIN MENU>>";
cout<<"\n\t\t1. Addition";
cout<<"\n\t\t2. Subtraction";
cout<<"\n\t\t3. Multiplication";
cout<<"\n\t\t4. Division";
cout<<"\n\nEnter First Number: ";
cin>>x;
cout<<"\nEnter Second Number: ";
cin>>y;
cout<<"\nEnter Code: ";
cin>>code;
if (code == 1)
{
ans=addition(x,y);
cout<<"\nThe sum is "<<ans;
Sleep(1500);
}
else if (code == 2)
{
ans=subtraction(x,y);
cout<<"\nThe difference is "<<ans;
Sleep(1500);
}
else if (code == 3)
{
ans=multiplication(x,y);
cout<<"\nThe product is "<<ans;
Sleep(1500);
}
else if (code == 4)
{
ans=division(x,y);
cout<<"\nThe quotient is "<<ans;
Sleep(1500);
}
system("cls");
} while (ans!=5);
}
int prog3()
{
int array [99999];
int num,a,i,j,temp;
int total = 0;
cout<<"Enter number of array: ";
cin>>num;
cout<<"\n";
for (a=0;a<num;a++)
{
cin>>array[a];
}
cout<<"\n";
for (a=0;a<num;a++)
{
cout<<array[a]<<" ";
total+=array[a];
}
cout<<"\n\nTotal is: "<<total;
for (i=0;i<num;i++)
{
for (j=0;j<num-i-1;j++)
{
if (array[j]>array[j+1])
{
temp=array[j];
array[j]=array[j+1];
array [j+1]=temp;
}
}
}
cout<<"\n\nSorted Array: ";
for (a=0;a<num;a++)
{
cout<<" "<<array[a];
}
}
int MultiplicationTable()
{
int a, b, x, y;
cout<<"Input Column: ";
cin>>x;
cout<<"Input Row: ";
cin>>y;
cout<<endl<<endl;
for (a=1; a<=x; a++)
{
for (b=1; b<=y; b++)
{
cout<<a*b<<"\t";
}
cout<<endl;
}
getch();
return 0;
}
int main()
{
string username;
int choice;
int attemptCount = 0;
string pass2="polbos322";
string setUser = "REYJAN";
//for (attemptCount = 0; attemptCount <3; attemptCount++)
//{
cout<<"Enter Username: ";
cin>>username;
cout<<"Enter Password: ";
char password[30];
int x=0;
char z;
for (x=0;

{
z = getch();
if ((z>='a' && z<='z') || (z>='A' && z<='Z') || (z>='0' && z<='9'))
{
password[x]=z;
x++;
cout<<"*";
}
if (z=='\b' && x>=1)
{
cout<<"\b \b";
x--;
}
if (z=='\r')
{
password[x]='\0';
break;
}
}
if (password == pass2 && username==setUser)
{
cout<<"\n\n\t\tLogin Successful"<<"\n"<<endl;
Sleep(1000);
system("cls");
}
else
{
cout<<"\n\n\tIncorrect username/password!"<<"\n"<<endl;
return 0;
}
//}
system("cls");
do
{
cout<<"\n\t\tMAIN MENU"<<"\n\t1. Payroll"<<"\n\t2. Transportation Matrix"<<"\n\t3. Conversion"<<"\n\t4. Subject Encoding";
cout<<"\n\t5. Adding & Sorting Entered Arrays"<<"\n\t6. Finding Sum, Difference, Product & Qoutient using function";
cout<<"\n\t7. Multiplication Table";
cout<<"\n\n\tEnter Your Choice: ";
cin>>choice;
system("cls");
if (choice == 1)
{
cout<<payroll();
Sleep(2000);
}
else if (choice == 2)
{
cout<<transportationMatrix();
Sleep(2000);
}
else if (choice == 3)
{
cout<<conversion();
Sleep(2000);
}
else if (choice == 4)
{
cout<<subjectEncode();
Sleep(2000);
}
else if (choice == 5)
{
cout<<prog3();
Sleep(2000);
}
else if (choice == 6)
{
cout<<function();
Sleep(2000);
}
else if (choice == 7)
{
cout<<MultiplicationTable();
Sleep(2000);
}
system("cls");
}
while (choice<8);
cout<<"\tInvalid Input";
return 0;
}