Results 1 to 25 of 38
Thread: source
Hybrid View
-
24th August 2008 17:52 #1Registered User
Join Date: May:2008
Location: varna
Posts: 82
source
, - , C++ , .
!
Code:#include <algorithm> #include <fstream> #include <iostream> using namespace std; int show_menu() { cout << "1. Add a bug report\n" << "2. Show bugs with specified level\n" << "3. Show bugs within a time period\n" << "4. Delete list of bugs\n" << "5. Quit\n"; int val; cin >> val; return val; } int BF; void do_bugs() { for (;;) { //loop 'forever' int icmd = show_menu(); switch(icmd) { case 1: { string data, descript; int id, level; cout << "give: level date" << endl; cin >> level >> data; cout << "give: description" << endl; getline(cin,descript); if (data == "*") { data = "today"; } int next_id(); id = next_id(); bool add_record(BF,id,level,data,descript); cout << "bug " << id << " added...\n"; } break; case 2: { int level; cout << "give minimum level\n"; cin >> level; show_and_filter(BF,level,**,**); } break; case 3: { string d1,d2; cout << "give lower and upper dates\n"; cin >> d1 >> d2; show_and_filter(BF,0,d1,d2); } break; case 4: { string ids; cout << "give IDs in ascending order\n"; getline(cin,ids); copy_and_remove(BF,DF,ids); } break; case 5: { default: cout << "unrecognized command\n"; } } }Last edited by rabut; 25th August 2008 at 08:22.
-
24th August 2008 18:12 #2
-
25th August 2008 08:25 #3Registered User
Join Date: May:2008
Location: varna
Posts: 82
, , :
w.c: In function void do_bugs():
w.c:38: error: add_record was not declared in this scope
w.c:46: error: expected primary-expression before , token
w.c:46: error: expected primary-expression before ) token
w.c:46: error: show_and_filter was not declared in this scope
w.c:53: error: show_and_filter was not declared in this scope
w.c:60: error: DF was not declared in this scope
w.c:60: error: copy_and_remove was not declared in this scope
w.c:67: error: expected `}' at end of input
-
25th August 2008 11:28 #4
- add_record do_bugs .
- add_record switch ...Last edited by ; 25th August 2008 at 11:35.
-
25th August 2008 17:33 #5Registered User
Join Date: May:2008
Location: varna
Posts: 82
, ?
-
25th August 2008 20:35 #6
add_record, show_and_filter, copy_and_remove . , .
-
26th August 2008 23:32 #7Registered User
Join Date: May:2008
Location: varna
Posts: 82

, out_file_name
out_file_name. , /usr.
,
. " invalid operands of types char [5] and char [5] to binary operator+ "

Code:#include <iostream> #include <vector> #include <string> #include <fstream> #include <cstdlib> using namespace std; char out_file_name[5],out_file_name3[5]; int main() { string pass; string flag = "l"; cout << "Enter Nickname: "; cin >> out_file_name; cout << "Enter password: "; cin >> pass; char dir[5] = "usr/"; out_file_name3 = out_file_name3 + dir; ofstream out; out.open(out_file_name3); out << out_file_name << " " << pass << " " << flag << endl; return main(); }
-
27th August 2008 09:35 #8
-
27th August 2008 09:52 #9
... "return main();", , ...
"return 0;", . .
"640K ught to be enough for anybody" - Bill Gates, 1981
::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel
-
27th August 2008 09:53 #10
-
27th August 2008 14:14 #11
-
27th August 2008 17:23 #12Registered User
Join Date: May:2008
Location: varna
Posts: 82
,


. , "request for member out_file_name in dir, which is of non-class type char [256]"
Code:char out_file_name[256],out_file_name3[5]; int main() { string pass; string flag = "l"; cout << "Enter Nickname: "; cin >> out_file_name; cout << "Enter password: "; cin >> pass; char dir[256] = "usr/";; strcat (dir,out_file_name); ofstream out; out.open(out_file_name3); out << out_file_name << " " << pass << " " << flag << endl; return 0; }Last edited by rabut; 27th August 2008 at 18:27.
-
27th August 2008 18:07 #13
strcat(dir.out_file_name). .
Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others
-
27th August 2008 18:25 #14Registered User
Join Date: May:2008
Location: varna
Posts: 82
..... "error: incompatible types in assignment of char* to char [256]"
strcat(dir.out_file_name) !
-
27th August 2008 18:33 #15
-
27th August 2008 18:40 #16Registered User
Join Date: May:2008
Location: varna
Posts: 82
-
27th August 2008 20:52 #17
-
27th August 2008 21:22 #18
-
28th August 2008 17:35 #19Registered User
Join Date: May:2008
Location: varna
Posts: 82
, "/usr" "/profile" = , = l
Last edited by rabut; 28th August 2008 at 17:41.
-
28th August 2008 18:58 #20Code:
int _tmain(int argc, _TCHAR* argv[]) { string nick; string pass; string flag = "l"; cout << "Enter Nickname: "; cin >> nick; cout << "Enter password: "; cin >> pass; // std::string, nick. ofstream write; write.open(nick.c_str()); write << nick << " " << pass << " " << flag << endl; return 0; }
-
28th August 2008 20:41 #21Registered User
Join Date: May:2008
Location: varna
Posts: 82
Last edited by rabut; 28th August 2008 at 22:26.
-
29th August 2008 22:03 #22
-
31st August 2008 15:44 #23Registered User
Join Date: May:2008
Location: varna
Posts: 82
-
1st September 2008 22:46 #24Registered User
Join Date: May:2008
Location: varna
Posts: 82

..!
, , ,
. - .
:
Code:#include <iostream> #include <fstream> using namespace std; char in_file_name[256]; int id(); int console(); int creat(); int main2(); ifstream in; string nick,pass,val; string usr="/usr"; int main() { cout << "Type login to login in system or creat to creat user: "; string tp; cin >> tp; if (tp == "login") { return id(); } if (tp == "creat") { return main2(); } if (tp != "login" && tp != "creat") { return main(); } } int main2() { cout << "New Username: "; cin >> nick; cout << "Enter password: "; cin >> pass; return creat(); } int creat() { ifstream in; ofstream out; out.open("prof.txt"); out << "usr/" << nick << endl; out.close(); in.open("prof.txt"); in >> in_file_name; in.close(); out.open(in_file_name); out << nick << " " << pass << endl; out.close(); system("rm prof.txt"); return main(); } int id() { cout << "Enter you'r Nickname: "; cin >> nick; cout << "Enter you'r password: "; cin >> pass; ofstream out; out.open("prof.txt"); out << "usr/" << nick << endl; out.close(); in.open("prof.txt"); in >> in_file_name; in.close(); system("rm prof.txt"); ifstream in; in.open(in_file_name); string n,p; in >> n >> p; if ( nick == n && pass == p) { return console(); } cout << "Wrong Username or Password!\n"; return main(); } int console() { cout << nick << ":~$ "; cin >> val; if (val != "help" && val != "creat" && val != "exit" && val != "logout") { cout << " '" << val << "' , 'help' !" << endl; } if (val == "logout") { return main(); } if (val == "exit") { cout << "Bye Bye " << nick << "! Good Luck! :)" << endl; return 0; } if (val == "help" || val == "Help") {cout << "\n" << "Help Menu:\n\n" << "!!! !!!\n\n" << "help - .\n" << "creat - .\n" << "exit - ." << endl;} if (val == "clear") { system("clear"); } return console(); }Last edited by rabut; 1st September 2008 at 22:59.
-
3rd September 2008 13:20 #25Registered User
Join Date: Sep:2006
Location: sofia
Posts: 5
, -
Code:#include <iostream> #include <fstream> using namespace std; void id(); void console(const string& nick, const string& pass); void creat(const string& nick, const string& pass); void main2(); int main() { for (;;) { cout << "Type login to login in system or creat to creat user: "; string tp; getline(cin, tp); if (tp == "login") { id(); } else if (tp == "creat") { main2(); } else if (tp == "exit") { break; } } return 0; } void main2() { string nick, pass; cout << "New Username: "; getline(cin, nick); cout << "Enter password: "; getline(cin, pass); creat(nick, pass); } void creat(const string& nick, const string& pass) { string tmp = "usr/" + nick; ofstream out; out.open(tmp.c_str()); if (out.is_open()) { out << nick << endl << pass << endl; out.close(); } else { cout << "Unable to open file " << tmp << endl; } } void id() { string nick, pass; cout << "Enter you'r Nickname: "; getline(cin, nick); cout << "Enter you'r password: "; getline(cin, pass); string tmp = "usr/" + nick; ifstream in; in.open(tmp.c_str()); string n, p; getline(in, n); getline(in, p); if (nick == n && pass == p) { console(nick, pass); } cout << "Wrong Username or Password!\n"; } void console(const string& nick, const string& pass) { for (;;) { cout << nick << ":~$ "; string val; getline(cin, val); if (val == "logout") { break; } else if (val == "exit") { cout << "Bye Bye " << nick << "! Good Luck! :)" << endl; exit(0); } else if (val == "help" || val == "Help") { cout << endl << "Help Menu:\n\n" "!!! !!!\n\n" "help - .\n" "creat - .\n" "exit - ." << endl; } else if (val == "clear") { system("clear"); } else { cout << " '" << val << "' , 'help' !" << endl; } } }




Reply With Quote



Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in