Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.18 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. //Prototypes go here
  8. //void output(int coolRanchSurvey[] , string doritos[]);
  9. int coolRanch(int choice, int userSurveyRating[], int coolRanchSurvey[], int coolRanchRaters);
  10.  
  11. int main()
  12. {
  13.     //Variables go here
  14.     string doritos[5] = {" ", "Cool Ranch", "Nacho Cheese", "Spicy Nacho", "Taco"};
  15.     string surveyChoices[3] = {"taste", "color", "after-breath"};
  16.     char again = ' ';
  17.  
  18.     int userSurveyRating[3] = {0};
  19.     int choice = 0;
  20.  
  21.     int coolRanchRaters = 0;
  22.  
  23.     //User input Survey Variables
  24.     int coolRanchSurvey[3] = {0};
  25.  
  26.     do
  27.     {
  28.         cout << "Welcome to the dorito survey." << endl;
  29.         cout << "------------------------------------------------" << endl;
  30.    
  31.         for(int i = 0; i < 4; i ++)
  32.         {
  33.             cout << "Please enter a " << i + 1 << " if you would like to do the survey on " << doritos[i] << " doritos." << endl << endl;
  34.         }
  35.  
  36.         cout << endl;
  37.         cout << "What type of dorito would you like to do your survey on?" << endl;
  38.         cin >> choice;
  39.  
  40.         for(int i = 0; i < 3; i ++)
  41.         {  
  42.             cout << "What would you rate the overall " << surveyChoices[i] << " of the " << doritos[1] << " dorito flavor?" << endl;
  43.             cin >> userSurveyRating[i];
  44.         }
  45.        
  46.             if(choice == 1)
  47.             {
  48.                 coolRanchSurvey[3] = coolRanch(choice, userSurveyRating, coolRanchSurvey, coolRanchRaters);
  49.             }
  50.             else
  51.             {
  52.                 cout << " " << endl;
  53.             }
  54.  
  55.         again = ' ';   
  56.         cout << "Would you like to run this program again? y or n: " << endl;
  57.         cin >> again;
  58.         again = tolower(again);
  59.  
  60.     }while(again == 'y');
  61.  
  62.     //output(coolRanchSurvey, doritos);
  63.  
  64.  
  65.     system("Pause");
  66.  
  67.     return 0;
  68. }
  69.  
  70. int coolRanch(int choice, int userSurveyRating[], int coolRanchSurvey[], int coolRanchRaters)
  71. {
  72.     int coolRanchTaste = 0;
  73.     int coolRanchColor = 0;
  74.     int coolRanchBreath = 0;
  75.  
  76.     if(choice = 1)
  77.     {
  78.         coolRanchRaters = coolRanchRaters + 1;
  79.     }
  80.  
  81.     coolRanchTaste = userSurveyRating[0];
  82.     coolRanchSurvey[0] = coolRanchSurvey[0] + coolRanchTaste;
  83.  
  84.     coolRanchColor = userSurveyRating[1];
  85.     coolRanchSurvey[1] = coolRanchSurvey[1] + coolRanchColor;
  86.  
  87.     coolRanchBreath = userSurveyRating[2];
  88.     coolRanchSurvey[2] = coolRanchSurvey[2] + coolRanchBreath;
  89.  
  90.     return coolRanchSurvey[3];
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement