get several lines and output limitations
K-Han · 2013-12-07 20:28:59
I have 2 questions in relation of this problem : 1. How can I get sveral lines and move theme in a srting variable? 2. how can I implement this : "All lines will be at most 64 characters, plus a trailing end-of-line character." ?
AMiR · 2013-12-07 20:53:02
You can use getline in c++.
#include <iostream>
using namespace std;
int main () {
string s;
while (getline(cin , s)) {
// `s` is one line of input. do what ever you want to it
}
return 0;
}
If you use string, maximum length of 64 should not be your concern!
K-Han · 2013-12-07 21:11:49
thank u so much! :)
pages:
- 1