Advertisement
N1E7R4V

Untitled

Dec 25th, 2012
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. // Сравнение 2 чисел.cpp: определяет точку входа для консольного приложения.
  2. //Задача 4.6
  3.  
  4. #include "stdafx.h"
  5. #include <stdio.h>
  6. #include <conio.h>
  7. #include "stdafx.h"
  8. #include <math.h>
  9. #include <iostream>
  10.  
  11. // функция сравнения чисел
  12. char s(int a, int b)
  13. {
  14.  char r;
  15.  if(a>b) r='>';
  16.   else if (a<b) r='<';
  17.    else r='=';
  18.  return(r);
  19. }
  20. // конец функции
  21.  
  22. void main()
  23. {
  24.  int x1,x2;    // сравниваемые числа
  25.  char r;    // результат сравнения
  26.  setlocale(LC_ALL, "Russian");
  27.  
  28.  printf("Введите 2 числа\n");
  29.  scanf("%i%i", &x1, &x2);
  30.  r=s(x1, x2);                 //вызов функции
  31.  printf("%i %c %i\n", x1, r, x2); //вывод результата
  32.  getch();
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement