MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

CPP/char array/counter.cpp:11–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10using namespace std;
11signed main(){
12 char a[100];
13 cin.get(a,100);
14 int n=strlen(a);
15 int digit=0,alpha=0,space=0;
16 for(int i=0;i<n;i++){
17 if(a[i]>='0' && a[i]<='9')
18 digit++;
19 else if((a[i]>='a' and a[i]<='z') or (a[i]>='A' and a[i]<='Z'))
20 alpha++;
21 else if(a[i]==' ')
22 space++;
23 }
24 cout<<a<<endl;
25 cout<<"digits "<<digit<<endl;
26 cout<<"alpha "<<alpha<<endl;
27 cout<<"space "<<space<<endl;
28
29
30 return 0;
31}

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected