Files
code_olymp/C++/строки/pass.cpp

29 lines
588 B
C++

#include <iostream>
#include <cstring>
#include <cstdio>
#include <cctype>
using namespace std;
int main() {
char parol[7]="qwerty", p[20];
cout <<"Ââåäèòå ïàðîëü:\n>";
gets (p);
if(strcmp(parol,p)!=0){
cout <<"Íåâåðíûé ïàðîëü\n";
system ("pause");
return 0;
}
cout <<"Äîñòóï ðàçðåø¸í!\n";
char s[70];
cout <<"Âåäèòå ôðàçó:\n>";
gets (s);
int n=strlen(s), k=0;
for (int i=0; i<n-1; i++) {
if (s[i]==' '&&s[i+1]!=' ') k++;
}
cout<<"Êîë-âî ñëîâ: "<<k+1<<endl;
system ("pause");
return 0;
}