|
|
back to boardВ чём ошибка? C++ Posted by Evgeniy 30 Oct 2012 18:56 Валят первым тестом, вроде работает #include <stdio.h> void main() { int i=0,cash=0; char text[1000]; gets(text); while(text[i]!=NULL && i<1001) { if (text[i]=='a' || text[i]=='d' || text[i]=='g' || text[i]=='j' || text[i]=='m' || text[i]=='p' || text[i]=='s' || text[i]=='v' || text[i]=='y' || text[i]=='.' || text[i]==' ') cash+=1; if (text[i]=='b' || text[i]=='e' || text[i]=='h' || text[i]=='k' || text[i]=='n' || text[i]=='q' || text[i]=='t' || text[i]=='w' || text[i]=='z' || text[i]==',') cash+=2; if (text[i]=='c' || text[i]=='f' || text[i]=='i' || text[i]=='l' || text[i]=='o' || text[i]=='r' || text[i]=='u' || text[i]=='x' || text[i]=='!' ) cash+=3; i++; } printf("%d",cash); } Edited by author 30.10.2012 18:58 |
|
|