Advertisement
Guest User

Untitled

a guest
May 6th, 2012
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. #include <iostream>
  2. # include <cstring>
  3. using namespace std;
  4. int main()
  5. {
  6. int const size = 20;
  7. char name1[size];
  8. char name2 [size];
  9. char name3 [size];
  10. char name4 [size];
  11. int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o;
  12. cout << "please tell me your first name:\n";
  13. cin >> name1;
  14. cout << "please tell me your last name:\n";
  15. cin >> name2;
  16. cout << "if you would like to give me (the computer) a first and last name\n press 1 if you want to use the calculator press 2\n";
  17. cin >> a;
  18. if(a == 1){
  19. cout << "please enter the first name:\n";
  20. cin >> name3;
  21. cout << "please enter the last name:\n";
  22. cin >> name4;
  23. cout << "you gave me the name" << name3 << " " << name4 << " " << "\nyou will now be taken to the calculator" << " " << name1 << " " << name2 << endl;
  24. }
  25. cout << "press 3 for addition or 4 for subtraction:\n";
  26. cin >> b;
  27. if(b == 3){
  28. cout << "you have choosen addition please put in you first\n and second vales followed by the enter key:\n";
  29. cin >> d;
  30. cin >> e;
  31. c = d + e;
  32. cout << d << "+" << e << "=" << c;
  33. }
  34. if(b == 4)
  35. {
  36. cout << "please put in you first and second\n value followed by the enter key:\n";
  37. cin >> g;
  38. cin >> h;
  39. f = g - h;
  40. cout << g << "-" << h << "=" << f;
  41. }
  42. return 0;
  43. if(a == 2){
  44. cout << "please press 5 for addition or 6 for\n subtraction followed by the enter key:\n";
  45. cin >> i;
  46. }if(i == 5)
  47. {
  48. cout << "please put in your first value and your\n second value followed by the enter key:\n";
  49. cin >> j;
  50. cin >> k;
  51. l = j + k;
  52. cout << j << "+" << k << "=" << i << endl;
  53. }if (i == 6){
  54. cout << "please enter your first and second valuse followed by the enter key:\n";
  55. cin >> o;
  56. cin >> n;
  57. m = o - n;
  58. cout << o << "-" << n << "=" << m << endl;
  59. }
  60. return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement