Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <stdio.h>
- #include <string.h>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "ru");
- int min = 10000, nomer = 0, counter = 0, iterator = 0, length;
- char str[80];
- cout << "Введите предложение:"<<endl;
- gets_s(str);
- counter = strlen(str);
- cout << counter<<endl;
- int nomer1 = 0;
- for (int i = 0; i < counter; i++)
- {
- length = 0;
- nomer1++;
- iterator = i;
- while ((str[iterator] != ' ')||(str[iterator] != '\0'))
- {
- iterator++;
- length++;
- }
- if (length < min)
- {
- min = length;
- nomer = nomer1;
- }
- iterator = i;
- }
- cout << "Слово минимальной длины под номером:" << nomer << endl << "С количеством символов:" << min << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement