Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Сравнение 2 чисел.cpp: определяет точку входа для консольного приложения.
- //Задача 4.6
- #include "stdafx.h"
- #include <stdio.h>
- #include <conio.h>
- #include "stdafx.h"
- #include <math.h>
- #include <iostream>
- // функция сравнения чисел
- char s(int a, int b)
- {
- char r;
- if(a>b) r='>';
- else if (a<b) r='<';
- else r='=';
- return(r);
- }
- // конец функции
- void main()
- {
- int x1,x2; // сравниваемые числа
- char r; // результат сравнения
- setlocale(LC_ALL, "Russian");
- printf("Введите 2 числа\n");
- scanf("%i%i", &x1, &x2);
- r=s(x1, x2); //вызов функции
- printf("%i %c %i\n", x1, r, x2); //вывод результата
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement