Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <string>
- #include <sstream>
- using namespace std;
- void metod(string x) {
- istringstream ss(x);
- string small, tmp;
- ss >> small;
- string big = small;
- while (ss >> tmp){
- if (tmp.size() < small.size())
- small = tmp;
- if (tmp.size() > big.size())
- big = tmp;
- }
- cout << "Длинное: " << big << " " << '\t' << '\n';
- cout << "Короткое: " << small <<" " << '\t' << '\n';
- }
- int main() {
- setlocale(LC_ALL, "ru");
- string str;
- while (str != "end") { // ввод строк, пока не будет *end*
- if (str == "end"){
- break;
- }
- else{
- getline(cin, str);
- metod(str);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement