Advertisement
SteelK

Untitled

Mar 9th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.06 KB | None | 0 0
  1. //#include "stdafx.h"
  2. #include <iostream>
  3. #include <cstring>
  4. #define SIZE 101
  5. //#define _CRT_SECURE_NO_WARNINGS
  6.  
  7. using namespace std;
  8.  
  9. char outchar(int in_number)
  10. {
  11.     char *outWord = new char [SIZE];
  12.     int snumber = in_number % 10;
  13.     switch (snumber)
  14.     {
  15.         case 1:
  16.         {
  17.             if (in_number % 100 == 11)
  18.             {
  19.                 strcpy(outWord, "ñòîëîâ");
  20.             }
  21.             else
  22.                 strcpy(outWord, "ñòîë");
  23.         }
  24.         break;
  25.  
  26.         case 2:
  27.         case 3:
  28.         case 4:
  29.         {
  30.             if ((in_number % 100 >= 12) && (in_number % 100 <= 14))
  31.             {
  32.                 strcpy(outWord, "ñòîëîâ");
  33.             }
  34.             else
  35.                 strcpy(outWord, "ñòîëà");
  36.         }
  37.  
  38.         default:
  39.         {
  40.             if ((in_number % 10 >= 5) && (in_number % 100 <= 20))
  41.                 strcpy(outWord, "ñòîëîâ");
  42.         }
  43.     }
  44.     cout << "outWord = " << outWord <<endl;
  45.     cout << "wordt = " << wordt <<endl;
  46.     char wordt [10];
  47.     strcpy(wordt, outWord);
  48.     return wordt[10];
  49.     delete [] outWord;
  50. }
  51.  
  52.  
  53. int main()
  54. {
  55.     int number = 0;
  56.  
  57.     setlocale(0, "");
  58.  
  59.     cout << "Ââåäèòå ÷èñëî\n";
  60.     cin >> number;
  61.  
  62.     cout << number << " " << outchar(number) << endl;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement