1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
#include <stdio.h >
int main ()
{
char string1[20];
char a='a', b='b', g='g', X='X', i='i', H='H', V='V', d='d', e='e', v='v', z='z', E='E', T='T', I='I', k='k', l='l', m='m', n='n', o='o', p='p', j='j', r='r', s='s', t='t', u='u', f='f', q='q', R='R', y='y', S='S', w='w', C='C', W='W', x='x', h='h', c='c', J='J', Z='Z';
int rigi;
int sum;
printf (" my word is:\n");
scanf( "%19s ", string1);
sum=0;
for (rigi = 0; string1[rigi] !='\0'; rigi++)
{
if (string1[rigi]==a ) {sum= sum +1;} else
if (string1[rigi]==b ) {sum= sum +2;} else
if (string1[rigi]==g ) {sum= sum +3;} else
if (string1[rigi]==d ) {sum= sum +4;} else
if (string1[rigi]==e ) {sum= sum +5;} else
if (string1[rigi]==v ) {sum= sum +6;} else
if (string1[rigi]==z ) {sum= sum +7;} else
if (string1[rigi]==E ) {sum= sum +8;} else
if (string1[rigi]==T ) {sum= sum +9;} else
if (string1[rigi]==i ) {sum= sum +10;} else
if (string1[rigi]==k ) {sum= sum +20;} else
if (string1[rigi]==l ) {sum= sum +30;} else
if (string1[rigi]==m ) {sum= sum +40;} else
if (string1[rigi]==n ) {sum= sum +50;} else
if (string1[rigi]==I ) {sum= sum +60;} else
if (string1[rigi]==o ) {sum= sum +70;} else
if (string1[rigi]==p ) {sum= sum +80;} else
if (string1[rigi]==J ) {sum= sum +90;} else
if (string1[rigi]==r ) {sum= sum +100;} else
if (string1[rigi]==s ) {sum= sum +200;} else
if (string1[rigi]==t ) {sum= sum +300;} else
if (string1[rigi]==V ) {sum= sum +400;} else
if (string1[rigi]==u ) {sum= sum +0;} else
if (string1[rigi]==f ) {sum= sum +500;} else
if (string1[rigi]==q ) {sum= sum +600;} else
if (string1[rigi]==R ) {sum= sum +700;} else
if (string1[rigi]==y ) {sum= sum +800;} else
if (string1[rigi]==S ) {sum= sum +900;} else
if (string1[rigi]==C ) {sum= sum +1000;} else
if (string1[rigi]==c ) {sum= sum +2000;} else
if (string1[rigi]==Z ) {sum= sum +3000;} else
if (string1[rigi]==w ) {sum= sum +4000;} else
if (string1[rigi]==W ) {sum= sum +5000;} else
if (string1[rigi]==x ) {sum= sum +6000;} else
if (string1[rigi]==X ) {sum= sum +7000;} else
if (string1[rigi]==j ) {sum= sum +8000;} else
if (string1[rigi]==h ) {sum= sum +9000;} else
if (string1[rigi]==H ) {sum= sum +1000;} else
{sum=0;}
}
printf ("%d\n" , sum);
return 0;
}
| |