my code is like this. can you tell me about my mistakesCode:#include<stdio.h>int main() { int count=0; char ch; while(ch!=EOF) { ch=getchar(); ch=(ch>='a'&& ch<='z')?(ch-'a'+'A'):ch; putchar(ch); if(ch) count++; } printf("%d",count); return 0; }
my code is like this. can you tell me about my mistakesCode:#include<stdio.h>int main() { int count=0; char ch; while(ch!=EOF) { ch=getchar(); ch=(ch>='a'&& ch<='z')?(ch-'a'+'A'):ch; putchar(ch); if(ch) count++; } printf("%d",count); return 0; }
Why is the letter "A" not reported as a letter? I am talking about the directions not about your code.
Edit2: I just figured out consonants are only what is supposed to be printed
Tim S.
Last edited by stahta01; 10-22-2018 at 01:06 PM. Reason: spelling
"...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson
Step 1: Write an program that outputs just the numbers of letters.
After getting that to work; store the consonants into an array and output that.
Tim S.
"...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson