PLEASE I NEED HELP! SOME CODES WOULD DO!

It should have a password authentication before it display the main program (use IF ELSE)
1. Password must not be showing upon typing. It should show asterisk (*).
2. Password must not be either my last name or your last name (SINCO,PERDIGON)
3. Only 5 attempts or 5 incorrect passwords, when 5 incorrect password are entered.,
the program should display "Maximum attempts reached! The program will terminate now.

Instructions should be done using with Switch Statement.
1.If Prelim Grade is selected, ask the user to input 5 assignments
5 seat works and 5 quizzes to calculate the prelim grade.
Grades:
PCS=(ave A*.20)+(ave S*.30)+(ave Q*.30)
PG= (PE/3)+(2*PCS/3)

2.If Midterm Grade is selected, ask the user to input 5 assignments
5 seat works and 5 quizzes to calculate the midterm grade
and ask the user to enter the prelim exam grade to calculate the
midterm grade.

Grades:
MCS=(ave A*.20) +(ave S*.30)+(ave Q*.50)
MSG=(ME/3) + (2+MCS/3)
MG=(PG/3)+(2*MSG/3)

3.If Final Grade is selected, ask the user to input 5 assignments
5 seat works and 5 quizzes to calculate the final class standing
then ask the user to input the Final Exam Grade to calculate the
Final Standing. Ask the user to input Midterm Grade to calculate
Final Grade.

Grades:

FCS=(ave A*.20) + (ave S*.30)+(ave Q*.50)
FSG=(FE/3)+(2+FCS/3)
FG=(MG/3)+(2*FSG/3)

Option for "Would you like to continue? [Y] or [N]*should be displayed. If yes, go back to the
main program where it will ask you to enter your name, If no, display thank you for using the program"
and terminate it.

(This is urgent.. can someone help me make a code for this.. i'm really going crazy now. ) Thank you guys!! :)
so far i have this code already..
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;


string getpass(const char *prompt, bool show_asterisk=true)
{
const char BACKSPACE=8;
const char RETURN=13;

string password;
unsigned char ch=0;

cout <<prompt<<endl;

while((ch=getch())!=RETURN)
{
if(ch==BACKSPACE)
{
if(password.length()!=0)
{
if(show_asterisk)
cout <<"\b \b";
password.resize(password.length()-1);
}
}
else if(ch==0 || ch==224)
{
getch();
continue;
}
else
{
password+=ch;
if(show_asterisk)
cout <<'*';
}
}
cout <<endl;
return password;
}

int main ()

{
const char *correct_password="sinco";
string password=getpass("Please enter the password: ",true);
if(password==correct_password)
cout <<"Correct password!"<<endl;


else
cout <<"Incorrect password. Try again"<<endl;

system("cls");


(But the thing is, i dont know where and what to put to make the 5 time tries for incorrect password inputs.
You mean like...


1
2
3
4
5
6
7
8
9
10
function name(){
for (int x=0;x<4;x++){
cout - enter password
cin - attempt;
if password is correct then whatever
else cout - try again
}
cout - 5 incorrect attempts. Now I'm hacking your bank account and maxing your credit cards.
return 0;
} 






















Topic archived. No new replies allowed.