Long time no see
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
#include <locale.h>
|
||||
int main() {
|
||||
setlocale(LC_ALL, "");
|
||||
float ch = 0,words = 0,o = 0;
|
||||
wchar_t x;
|
||||
while((x = getwchar()) != WEOF){
|
||||
switch(x){
|
||||
case ' ':
|
||||
ch += o;
|
||||
if(o>0) words++;
|
||||
o = 0;
|
||||
break;
|
||||
default:
|
||||
o++;
|
||||
}
|
||||
}
|
||||
|
||||
printf("\nch per word - %.2f\n",ch/words);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user