10197 - Learning Portuguese

All about problems in Volume 101. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

claus
New poster
Posts: 3
Joined: Sat Jan 02, 2016 2:44 am

Re: 10197 - Learning Portuguese

Post by claus »

hi ! man a need a help in this problem. if you can help me ? result WA

#include <stdio.h>
#include <stdlib.h>

int main()
{

char s[30], v[30];
int w = 0, flag=0;


while(scanf("%s" ,s) !=EOF){

char a = getchar();
gets(v);
w = strlen(s);

if(flag == 1 )
printf("\n");


printf("%s (to %s)",s,v);

if(w < 2){
printf("\nUnknown conjugation\n");
flag = 1;
continue;
}
char b = (char)ver(s,w);


if(b =='a')
conj1(s,w);

if(b == 'e')
conj2(s,w);

if(b =='i')
conj3(s,w);

if(b != 'a' && b!= 'e' && b!= 'i')
printf("\nUnknown conjugation\n");

flag = 1;
}
return 0;
}

int ver(char s[] , int w){


if(s[w-1] == 'r' && s[w-2]=='a')
return (int)'a';

if(s[w-1] == 'r' && s[w-2]=='e')
return (int)'e';

if(s[w-1] == 'r' && s[w-2]=='i')
return (int)'i';

return (int)'o';

}



void conj1(char s[], int w){

s[w-2] = '\0';
printf("\neu %so",s);
printf("\ntu %sas",s);
printf("\nele/ela %sa",s);
printf("\nn%cs %samos",(char)162,s);
printf("\nv%cs %sais",(char)162,s);
printf("\neles/elas %sam\n",s);


}

void conj2(char s[],int w){


s[w-2] = '\0';
printf("\neu %so",s);
printf("\ntu %ses",s);
printf("\nele/ela %se",s);
printf("\nn%cs %semos",(char)162,s);
printf("\nv%cs %seis",(char)162,s);
printf("\neles/elas %sem\n",s);


}
void conj3(char s[], int w){

s[w-2] = '\0';
printf("\neu %so",s);
printf("\ntu %ses",s);
printf("\nele/ela %se",s);
printf("\nn%cs %simos",(char)162,s);
printf("\nv%cs %sis",(char)162,s);
printf("\neles/elas %sem\n",s);

}
Post Reply

Return to “Volume 101 (10100-10199)”