Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <time.h>
- #include <math.h>
- #include <string>
- using namespace std;
- int main(){
- srand(time(0));
- //W dowolnym ciągu znaku policz samogłoski (angielskie małe)
- char samo[7] = {'a','e','o','u','y','i','\0'};
- string napis="Kacper i Magda";
- int roz=napis.size();
- int ilosc=0;
- int miejsce=0;
- for(int i=0;i<=5;i++)
- {
- if(napis.find(samo[i])==string::npos)
- {
- cout<<"W tym wyrazie nie ma samogloski "<<samo[i]<<" "<<endl;
- }
- if(miejsce = napis.find(samo[i])!=string::npos){
- ilosc++;}
- miejsce=napis.find(samo[i]);
- for (int j=1;j<=roz;j++){
- if(napis.find(samo[i],miejsce+1)!=string::npos)
- {
- ilosc++;
- miejsce=napis.find(samo[i],miejsce+1);
- }
- }
- }
- cout<<"Ten tekst ma "<<ilosc<<" samoglosek";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement