প্রবলেমটি পড়ুন এবং বুঝুন
#include<iostream>
#include<cstdlib>
#include<string>
using namespace std;
void loop(char *ch)
{
int i=0,counter=0;
while(ch[i]!=NULL)
{
if((ch[i]>=65 && ch[i]<=90)|| (ch[i]>=97 && ch[i]<=122))
{
for(;(((ch[i]>=65 && ch[i]<=90)|| (ch[i]>=97 && ch[i]<=122)) &&(ch[i]!='\n'));i++);
counter++;
}
else
i++;
}
cout<<counter<<endl;
}
int main()
{
string str;
while(getline(cin,str))
{
loop(&str[0]);
}
return 0;
}
#include<iostream>
#include<cstdlib>
#include<string>
using namespace std;
void loop(char *ch)
{
int i=0,counter=0;
while(ch[i]!=NULL)
{
if((ch[i]>=65 && ch[i]<=90)|| (ch[i]>=97 && ch[i]<=122))
{
for(;(((ch[i]>=65 && ch[i]<=90)|| (ch[i]>=97 && ch[i]<=122)) &&(ch[i]!='\n'));i++);
counter++;
}
else
i++;
}
cout<<counter<<endl;
}
int main()
{
string str;
while(getline(cin,str))
{
loop(&str[0]);
}
return 0;
}
No comments:
Post a Comment