hello ,
i am starting to program my project in c++
i need help in direction.
my project is like wikpedia . i should enter about 3 value in each catagory (3*7) .
the search will be by pressing some value and then a list will open with all the value that it found. choice will happen by pressing a number (1-5) and there will be another botton (6) that will send to another page with more choices.
the user can typing a value and the pc will ask if it is the value he want if Y he will show the value
if N he will open the search window again.
pressing Y will enter the user to a window that show :
1. free search: a. the exect value.
b. at least 1 word.
2.serch by category .
3. random search the pc will found randomly value and then he will ask if the user want this value.Y will enterr N will cancel and go to the search again.
creat an account:
by fill in private details , USER NAME , passwor (6 numbers), question for restore the password
3 incorect pass typing will bring to an exit
there be an restore password option.
the value name will be bold and with color and the other txt will not.
i wrote the begening code
i have some problam :
1) when im pressing 'C' he show me an error , he say that question and answer allready in use.
2) for exemple: when im pressing Y or N in the 'Q' option he do nothing. and show the press any key to continue.
3)how do i program an option to do an accountt? how the password will show like ********
4) how do i program that if i press little letter q instade of Q he will recognize it like Q ?
this is the code:
/* search_engine */
#include <iostream>
#include <string>
using namespace std;
void log_in (string name , string password);
void creat (string name , string password , float question , float answer );
int main(int argc, char* argv[])
{
char choice ;
string name, password;
int quit;
float question, answer;
cout <<"\n\t\t-----------------------------------------";
cout << "\n\t\t Hello Guest! Welcome to search engine!\n";
cout<<"\t\t-----------------------------------------\n";
cout << "What would you like to do: \n\n";
cout << "[L]og In \n" << "[C]reat an account \n" ;
cout << "[G]uest \n" << "[Q]uit \n\n";
cout <<"Press a letter (L , C , G , Q): "; cin >> choice;
switch (choice)
{
case 'L': log_in (name , password) ; break;
case 'C': creat (name ,password , question, answer); break ;
case 'G': cout <<"\n\t\t\t\t-----\n"; cout <<"\t\t\t\tGuest\n";
cout<<"\t\t\t\t-----\n"; break;
case 'Q': cout << "Are you sure you want to exit the program? Y/N \n"; cin >> quit;
if (quit == 'Y' )
exit (0) ;
else choice ; break;
}
return 0;
}
void log_in (string name, string password)
{
cout <<"\n\t\t\t Log in for an existing account. \n\n";
cout << "User Name: ";
getline (cin,name); cout <<'\n';
cout <<"Password: ";
cin >> password; cout <<"\n\n";
cout <<"Welcome Back " << name; cout <<"\n\n";
cout << "Press [H]istory to view your search history";
}
void creat (string name , string pass , float question , float answer )
{
cout <<"\n\t\t\t Creat an account. \n";
cout <<"\t\t Please fill in the following questions \n";
cout <<"User Name:";
getline (cin,name); cout <<'\n';
cout <<"Password (6 numbers max):\n";
cin >> pass; cout <<'\n';
cout <<"Re-type your password: ";
cin >> pass; cout <<'\n';
cout <<"Question to restore your password: ";
cin >> question; cout <<'\n';
cout <<"Answer: ";
cin >> answer ; cout <<'\n';
}
any help will welcome!!