Advertisement
Guest User

Untitled

a guest
May 28th, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3.  
  4. using namespace std;
  5.  
  6. int main(){
  7.  
  8. string Destination;
  9. string Avsluta;
  10. int x;
  11. do{
  12. cout << "Detta program ber\x84knar biljettpriset f\x94r dig som vill resa \ntill Kiruna eller Levi. Normalpriset till Kiruna \x84r 2400 kr, till Levi 2000 kr."<< endl;
  13. cout << "\nAnge resm\x86l: ";
  14. cin >> Destination;
  15.  
  16. if (Destination == "Kiruna") {
  17. cout << "\nAnge \x86lder: ";
  18. cin >> x;
  19. if (x <= 17){
  20. cout << "\nResan kostar 1200kr";
  21. }
  22. else if (x > 17 && x < 65){
  23. cout << "\nResan kostar 2400kr";
  24. }
  25. else if (x > 64){
  26. cout << "\nresan kostar 600kr";
  27. }
  28.  
  29.  
  30.  
  31. }
  32. else if (Destination == "Levi") {
  33. cout << "\nAnge \x86lder: ";
  34. cin >> x;
  35. if (x <= 17){
  36. cout << "\nResan kostar 1000kr";
  37. }
  38. else if (x > 17 && x < 65){
  39. cout << "\nResan kostar 2000kr";
  40. }
  41. else if (x > 64){
  42. cout << "\nresan kostar 500kr"<< endl;
  43. }
  44.  
  45.  
  46.  
  47. }
  48. else{
  49. cout << "OBS! Ange korrekt resmx86!";
  50. }
  51. cin.ignore();
  52.  
  53. cout << "\n \nForts\x84tt med 'Enter' avsluta med 'q'. ";
  54.  
  55. if(cin.get()=='\n'){
  56.  
  57. system("cls");
  58.  
  59. }
  60. else{
  61.  
  62. Avsluta = 'q';
  63.  
  64. }
  65.  
  66. }
  67. while(Avsluta.compare("q") != 0);
  68.  
  69.  
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement