@nnina
2 / 2 / 0
Регистрация: 12.11.2011
Сообщений: 69
|
|
|
17.12.2011, 09:12. Просмотров 429. Ответов 9
Не получается перевести из С в C++:
C | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| #include <stdio.h>
#include <stdlib.h>
using namespace std;
int mycompare(int first, int second)
{
if(first > second) return 1;
else if(first == second) return 0;
else if(first < second) return -1;
}
int main()
{
int a, b, res;
printf("Input number A:\t");
scanf("%d", &a);
printf("Input number B:\t");
scanf("%d", &b);
res = mycompare(a, b);
if(res == 1) printf("%d > %d\n", a, b);
else if(res == 0) printf("%d = %d\n", a, b);
else if(res == -1) printf("%d < %d\n", a, b);
system("pause");
return 0;
} |
|
0
|