Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void poz_max_slova(char stroka[],int&probel_do_slova,int&probel_posle_slova)
- {
- int i=0;
- int probel_do_slova_new=0;
- while (stroka[i]!=0)
- {
- if (stroka[i]==32)
- probel_do_slova_new=i;
- if (i-probel_do_slova_new>probel_posle_slova-probel_do_slova)
- {
- probel_do_slova=probel_do_slova_new;
- probel_posle_slova=i;
- }
- i++;
- }
- }
- void vivod_slova(char stroka[],int probel_do_slova,int&probel_posle_slova)
- {
- for (int i=0;i<=probel_posle_slova-probel_do_slova;i++)
- {
- cout<<stroka[probel_do_slova+i];
- }
- }
- int main()
- {
- char stroka[100];
- int prdoslova=0;
- int prposlslova=0;
- cin.getline(stroka,100);
- poz_max_slova(stroka,prdoslova,prposlslova);
- vivod_slova(stroka,prdoslova,prposlslova);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement