cout << "Variables, input, and output\n\nPlease enter your first name and press \<ENTER\>.\nName: "; cin >> name;
cout << "\nPlease enter your age and press \<ENTER\>.\nAge: "; cin >> age;
cout << "\nHello " << name << "!\nYou are " << age << " years old!\r\n";
system("PAUSE"); }
Er nok den nemmeste måde at gøre det på.
Synes godt om
Slettet bruger
28. november 2005 - 18:55#2
Ok... Tester det lige...
Synes godt om
Slettet bruger
28. november 2005 - 18:59#3
Hehee...! Så virker det... Kan man vel godt sige, men... Jeg vil jo bare holde vinduet obent; ikke have in tekst frem om at trykke en tast for at lukke... Kan jeg ikke bare få vinduet til at blive åbent, så jeg selv kan skrive en tekst og brugeren derefter kan lukke vinduet ned - UDEN den indbyggede meddelelse?
cout << "Closing window\n\nHow would you rate C++ from 1 to 5?\nPlease type your ansver and press \<ENTER\>.\nRating: "; Get(cin, rating);
cout << "\n\nPlease enter a comment and press \<ENTER\>.\nComment: \n\n"; getline(comment);
if(rating < 0) { cout << "Whoa! You really don't like C++...\nYou rated it " << rating << "!\nYou also wrote:\n" << comment << "\nInteresting..."; } else if(rating == 0) { cout << "I see you really don't like C++...\nYou rated it " << rating << "!\nYou also wrote:\n" << comment << "\nInteresting..."; } else if(rating == 1) { cout << "I see you don't like C++...\nYou rated it " << rating << ".\nYou also wrote:\n" << comment << "\nHmm..."; } else if(rating > 1 && rating < 5) { cout << "Ok...\nYou rated it " << rating << "...\nYou also wrote:\n" << comment << "\nPretty normal..."; } else if(rating == 5) { cout << "I see you like C++...\nYou rated it " << rating << "!\nYou also wrote:\n" << comment << "\nI like C++ too!"; } else if(rating > 5) { cout << "I see you really like C++!\nYou rated it " << rating << "!\nYou also wrote:\n" << comment << "\nI like C++ too!"; } else { cout << "There must be some mistake...\nYou rated it " << rating << "!\You also wrote:\n" << comment << "\nWierd..."; } cout "\n\nPress \<ENTER\> to close this window."; cin.get(); }
cout << "Closing window\n\nHow would you rate C++ from 1 to 5?\nPlease type your ansver and press <ENTER>.\nRating: "; Get(rating);
cout << "\n\nPlease enter a comment and press <ENTER>.\nComment: \n\n"; getline(cin, comment);
if(rating < 0) { cout << "Whoa! You really don't like C++...\nYou rated it " << rating << "!\nYou also wrote:\n" << comment << "\nInteresting..."; } else if(rating == 0) { cout << "I see you really don't like C++...\nYou rated it " << rating << "!\nYou also wrote:\n" << comment << "\nInteresting..."; } else if(rating == 1) { cout << "I see you don't like C++...\nYou rated it " << rating << ".\nYou also wrote:\n" << comment << "\nHmm..."; } else if(rating > 1 && rating < 5) { cout << "Ok...\nYou rated it " << rating << "...\nYou also wrote:\n" << comment << "\nPretty normal..."; } else if(rating == 5) { cout << "I see you like C++...\nYou rated it " << rating << "!\nYou also wrote:\n" << comment << "\nI like C++ too!"; } else if(rating > 5) { cout << "I see you really like C++!\nYou rated it " << rating << "!\nYou also wrote:\n" << comment << "\nI like C++ too!"; } else { cout << "There must be some mistake...\nYou rated it " << rating << "!\You also wrote:\n" << comment << "\nWierd..."; } cout "\n\nPress <ENTER> to close this window."; cin.get(); }
Synes godt om
Slettet bruger
29. november 2005 - 17:20#9
Hov, et sted står der \ hvor der skulle stå \n... Sorry!
Gør skam ikke noget, det var bertel's svar der var din løsning ;)
Synes godt om
Slettet bruger
01. april 2006 - 18:56#18
Tak for det... Jeg hader at lave fejl :S
--- LUKKET - FOR REAL! ---
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.