arguments - C++ Multiple Functions Not Recognized -
this may simple error, made function called longin_page();
int login_page(string username,string password) {
anyways, function header, function long. however, when call function in file(to function defined , referenced), seems not recognize 2 arguments have defined.
else if (input1 == "login") { get_user_info(); login_page(file_username, file_password); }
in visual studio, error saying function not take 2 arguments. in case wanted check files, posted below.
login_page.cpp:
#include <iostream> #include <windows.h> #include "login_page.h" #include <string> #include <fstream> #include "profile_main_menu.h"using namespace std; string file_username, file_password; int get_user_info() { ifstream user_info; user_info.open("user_info.txt"); if (user_info.is_open()) { user_info >> file_username; user_info >> file_password; cout << "file open" << endl; cout << file_username << endl; cout << file_password; } else { cout << "could not info fro user_info.txt" << endl; } return 0; } int login_page(string username,string password) { string username_input_2; string password_input_2; ifstream user_info; user_info.open("user_info.txt"); string file_username, file_password; if (user_info.is_open()) { get_user_info(); } else { cout << "error: no username and/or password found on user_info.txt" << endl; login_page(); } cout << "please enter username: " << endl; cin >> username_input_2; if (username == username_input_2) { cout << username_input_2 << " , please enter password." << endl; cin >> password_input_2; if (password == file_password) { profile_main_menu(); } else { cout << "passwords not match. please try again." << endl; login_page(); } } else { cout << "you not have account or have misspeld username. please try again." << endl; cout << username_input_2 << endl; cout << username << endl; login_page(); } return 0;
}
login_page.h:
#define login_page_h int login_page(); int get_user_info();
initial_page_funct.cpp: (this error)
#include <iostream> #include <string> #include <windows.h> #include "login_page.h" #include "create_account.h" using namespace std; extern string file_username, file_password; int initial_login() { string input1; cout << "welcome agentos v230.20043." << endl; sleep(3000); cout << "if not have account , wish create one, enter \"create account\"" << endl; sleep(3000); cout << "if have account, enter \"login\"" << endl; getline(cin, input1); if (input1 == "create account") { create_account(); } else if (input1 == "login") { get_user_info(); login_page(file_username, file_password); } else { cout << "you have not entered knowned command. please try again." << endl; cout << "this command: " << input1 << endl; initial_login(); } return 0;
}
the function declaration in header not correct. in login_page.h replace
int login_page();
with:
int login_page(string username,string password);
Comments
Post a Comment