top of page

#include <fstream>

using namespace std;

 

int main()

{

                int n=0;

                string p="";

                cout<<"Scrie o propozitie/ fraza. "<<endl;

                getline(cin,p);

 

                for (int i=0; i<p.length(); i++)

                {

                                if ((p[i]=='b') || (p[i]=='c') || (p[i]=='d') || (p[i]=='f') || (p[i]=='g' || p[i]=='h') || (p[i]=='j') || (p[i]=='k') || (p[i]=='l') || (p[i]=='m') ||(p[i]=='n') || (p[i]=='p') || (p[i]=='r') || (p[i]=='q') || (p[i]=='s') || (p[i]=='t') || (p[i]=='v') || (p[i]=='x') || (p[i]=='z') || (p[i]=='B') || (p[i]=='C') || (p[i]=='D') || (p[i]=='F') || (p[i]=='G' || p[i]=='H') || (p[i]=='J') || (p[i]=='K') || (p[i]=='L') || (p[i]=='M') ||(p[i]=='N') || (p[i]=='P') || (p[i]=='R') || (p[i]=='Q') || (p[i]=='S') || (p[i]=='T') || (p[i]=='V') || (p[i]=='X') || (p[i]=='Z'))

                                n=n+1;

                }

                cout<<n<<endl;

                ifstream f("consoane.in");

    ofstream g("consoane.txt");

    g<<p<<endl;

                f>>n;

                g<<"Numarul de consoane este "<<n<<endl;

                return 0;

}

bottom of page