-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy path10197.cpp
More file actions
executable file
·114 lines (88 loc) · 2.26 KB
/
10197.cpp
File metadata and controls
executable file
·114 lines (88 loc) · 2.26 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/* Problem: Learning Portuguese UVa 10197
Programmer: Md. Mahmud Ahsan
Description: Ad-hoc
Compiled: Visual C++ 7.0
Date: 21-08-06
*/
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
using namespace std;
void strRev(char *str){
char temp[100];
int len = strlen(str)-1;
int i;
for (i = 0; str[i]; ++i){
temp[i] = str[len-i];
}
temp[i] = '\0';
strcpy(str, temp);
}
int main(){
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
//ar, er, ir vowels: a, e, i
bool flag = false;
char v1[100], v2[100], word[100], ch[3];
int len, i, temp;
while (cin >> v1 >> v2){
if (flag) cout << endl; flag = true;
cout << v1 << " (to " << v2 << ")" << endl;
len = strlen(v1);
ch[0] = v1[len-1];
ch[1] = v1[len-2];
ch[2] = '\0';
strRev(ch);
for (i = 0; i < len - 2; ++i){
word[i] = v1[i];
}
word[i] = '\0';
if (strcmp(ch, "ar") == 0){
printf("%-10s", "eu");
cout << word << "o" << endl;
printf("%-10s", "tu");
cout << word << "as" << endl;
printf("%-10s", "ele/ela");
cout << word << "a" << endl;
printf("%-10s", "nós");
cout << word << "amos" << endl;
printf("%-10s", "vós");
cout << word << "ais" << endl;
printf("%-10s", "eles/elas");
cout << word << "am" << endl;
}
else if (strcmp(ch, "er") == 0){
printf("%-10s", "eu");
cout << word << "o" << endl;
printf("%-10s", "tu");
cout << word << "es" << endl;
printf("%-10s", "ele/ela");
cout << word << "e" << endl;
printf("%-10s", "nós");
cout << word << "emos" << endl;
printf("%-10s", "vós");
cout << word << "eis" << endl;
printf("%-10s", "eles/elas");
cout << word << "em" << endl;
}
else if (strcmp(ch, "ir") == 0){
printf("%-10s", "eu");
cout << word << "o" << endl;
printf("%-10s", "tu");
cout << word << "es" << endl;
printf("%-10s", "ele/ela");
cout << word << "e" << endl;
printf("%-10s", "nós");
cout << word << "imos" << endl;
printf("%-10s", "vós");
cout << word << "is" << endl;
printf("%-10s", "eles/elas");
cout << word << "em" << endl;
}
else{
cout << "Unknown conjugation" << endl;
}
}
return 0;
}