Run Code
|
Code Wall
|
Users
|
Misc
|
Feedback
|
About
|
Login
|
Theme
|
Privacy
#26.fix
#include <iostream> #include <string> using namespace std; void czyscBufor (){ cin.clear(); cin.sync(); } void wczytajOsobe(string &im, string &naz, string &wiek){ cout << endl << "Podaj imiÄ™"; //czyscBufor(); getline(cin, im); //cin >> im; cout << endl << "Podaj nazwisko"; //czyscBufor(); getline(cin, naz); //cin >> naz; do { cout << endl << "Wiek: "; //czyscBufor(); //cin >> wiek; getline(cin, wiek); // PROBLEM z uzyciem getline i cin w jednym miejscu, poniewaz po uzyciu cin a pozniej probie pobrania tekstu getline, nie wystarcza inputu dla cin } while (cin.fail()); cout << im << naz << wiek; } void wypiszOsobe(string im, string naz, string wiek){ cout << endl << im << " " << naz << "," << wiek; } int main() { std::string imie[ 2 ]; std::string nazwisko[ 2 ]; string wiek[ 2 ]; for( int i = 0; i < 2; i++ ) wczytajOsobe( imie[ i ], nazwisko[ i ], wiek[ i ] ); for( int i = 0; i < 2; i++ ) wypiszOsobe( imie[ i ], nazwisko[ i ], wiek[ i ] ); return 0; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
calling conventions and using an override class to change another classes values
CT1
Cross-platform multithreading minimal example (g++ and cl.exe)
auto decltype - Return Type Deduction C++ | C++14
assaa
Removing __unaligned specifier partial solution
0004
VC++ latest rejects istream to nullptr comparison
Postfix side effect returning 2
new
Please log in to post a comment.