جزاكم الله الف خير....
الأن مطلوب مني عمل برنامج يحسب عدد حروف العله في الجمله الواحده...
عملت البرنامج لكني أتوقع أن هناك خطأ logic أرجو مساعدتي في معرفته....
محاولتي...
#include<iostream>
using namespace std;
int main()
{
char text,a,e,i,o,u;
int counta=0,counte=0,counti=0,counto=0,countu=0;
cout<<"enter the text"<<endl;
cin>>text;
while(text!='.')
{
for(int i=0;i<=text;i++)
{
switch(text)
{
case'a':
counta++;break;
case 'e':
counte++;break;
case 'i':
counti++;break;
case 'o':
counto++;break;
case'u':
countu++;break;
default:cout<<"the text is invalid";
}
cin>>text;
}
}
cout<<"the number of a is"<<a<<endl;
cout<<"the number of e is:"<<e<<endl;
cout<<"the number of i is:"<<i<<endl;
cout<<"the number of o is:"<<o<<endl;
cout<<"the number of u is:"<<u<<endl;
return 0;
}
