Guest User

Untitled

a guest
Apr 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.45 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. // Sets the Maximum allowed number of digits to be entered in the array.
  6. const int Max_Number = 20;
  7.  
  8. // Input function for the numbers
  9. void input_Large_Int ( int a[], int& size_of_A );
  10.  
  11. // Outputs the sum of the 2 numbers
  12. void output_Large_Int ( int a[], int size_of_A );
  13.  
  14. // The sum function for the program
  15. void add ( int a[], int size_of_A, int sum[] );
  16.  
  17. int main()
  18. {
  19. //Declares the arrays
  20. int a[Max_Number], b[Max_Number], sum[Max_Number];
  21. int size_of_A, size_of_B;
  22.  
  23. char response='y';
  24. while (response == 'y' || response == 'Y')
  25.     {
  26.  
  27.     input_Large_Int( a, size_of_A );
  28.  
  29.     }
  30.  
  31. cout << "Would you like to add two more numbers? ( Y-Yes, N-No ):" << endl;
  32. cin >> response;
  33. cout << endl;
  34.  
  35. }
  36.  
  37. void input_Large_Int ( int a[], int& size_of_A )
  38. {
  39.     char num_1 [Max_Number], num_2 [Max_Number];
  40.  
  41.     cout << "Please input the first number that has less than 20 numbers: " << endl;
  42.     cin >> num_1;
  43.     cout << endl;
  44.     if ( num_1[Max_Number] > 20 )
  45.     {
  46.         cout << "Integer Overflow!!!" << endl;
  47.         cout << "Re-Enter a number that has less than 20 digits!!!" << endl;
  48.     }
  49.  
  50.     cout << "Please input the second number that has less than 20 numbers: " << endl;
  51.     cin >> num_2;
  52.     cout << endl;
  53.     if ( num_2[Max_Number] > 20 )
  54.     {
  55.         cout << "Integer Overflow!!!" << endl;
  56.         cout << "Re-Enter a number that has less than 20 digits!!!" << endl;
  57.     }
  58. }
Add Comment
Please, Sign In to add comment