Если мой код правильный или нет
#include <iostream> #include <string> using namespace std; int main() { string user[2] = {"may","kj"}; int pass[2] = { 686668,7977979 }; string username; string x; int passeword; int y; string press; string delate; //add user cout << "do you want to add username press ok or not press not " << endl; cin >> press; if (press == "ok") { cout << "enter new username: " << endl; cin >> username; user[2] = username; for (int i = 0; i <= 2; i++) { if (username == user[i]) { cout << "username already exist" << endl; } else { cout << "enter the passeword : " << endl; cin >> passeword; pass[2] = passeword; cout << "username already added" << endl; } cout << user << endl << pass << endl; } } else //delate { cout << "do you want to delate any username press yes or not" << endl; cin >> delate; if (delate == "yes") { cout << "enter your username: " << endl; cin >> username; string sure; cout << "are you sure to delate this username" << endl; cin >> sure; if (sure == "yes") { cout << "the username already delate" << endl; } else { cout << "ok" << endl; } } else { cout << "username didn't delate" << endl; } } //login string login; cout << "login press log or sigup press sign" << endl; cin >> login; if (login == "log") { cout << "enter your username" << endl; cin >> username; cout << "enter your passeword" << endl; cin >> passeword; for (int i = 0; i <= 2; i++) { for (int z = 0; z <= 2; z++) { if (username == user[i]) { if (passeword == pass[z]) { cout << "already login" << endl; } else { cout << "please enter passewor again" << endl; cin >> passeword; } } else { cout << "username not found please enter username again" << endl; cin >> username; } } } } else { cout << "enter new username: " << endl; cin >> username; cout << "enter the passeword : " << endl; cin >> passeword; cout << "already sig in" << endl; } }
Что я уже пробовал:
найти лучшее решение
я новичок