Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- //Prototypes go here
- //void output(int coolRanchSurvey[] , string doritos[]);
- int coolRanch(int choice, int userSurveyRating[], int coolRanchSurvey[], int coolRanchRaters);
- int main()
- {
- //Variables go here
- string doritos[5] = {" ", "Cool Ranch", "Nacho Cheese", "Spicy Nacho", "Taco"};
- string surveyChoices[3] = {"taste", "color", "after-breath"};
- char again = ' ';
- int userSurveyRating[3] = {0};
- int choice = 0;
- int coolRanchRaters = 0;
- //User input Survey Variables
- int coolRanchSurvey[3] = {0};
- do
- {
- cout << "Welcome to the dorito survey." << endl;
- cout << "------------------------------------------------" << endl;
- for(int i = 0; i < 4; i ++)
- {
- cout << "Please enter a " << i + 1 << " if you would like to do the survey on " << doritos[i] << " doritos." << endl << endl;
- }
- cout << endl;
- cout << "What type of dorito would you like to do your survey on?" << endl;
- cin >> choice;
- for(int i = 0; i < 3; i ++)
- {
- cout << "What would you rate the overall " << surveyChoices[i] << " of the " << doritos[1] << " dorito flavor?" << endl;
- cin >> userSurveyRating[i];
- }
- if(choice == 1)
- {
- coolRanchSurvey[3] = coolRanch(choice, userSurveyRating, coolRanchSurvey, coolRanchRaters);
- }
- else
- {
- cout << " " << endl;
- }
- again = ' ';
- cout << "Would you like to run this program again? y or n: " << endl;
- cin >> again;
- again = tolower(again);
- }while(again == 'y');
- //output(coolRanchSurvey, doritos);
- system("Pause");
- return 0;
- }
- int coolRanch(int choice, int userSurveyRating[], int coolRanchSurvey[], int coolRanchRaters)
- {
- int coolRanchTaste = 0;
- int coolRanchColor = 0;
- int coolRanchBreath = 0;
- if(choice = 1)
- {
- coolRanchRaters = coolRanchRaters + 1;
- }
- coolRanchTaste = userSurveyRating[0];
- coolRanchSurvey[0] = coolRanchSurvey[0] + coolRanchTaste;
- coolRanchColor = userSurveyRating[1];
- coolRanchSurvey[1] = coolRanchSurvey[1] + coolRanchColor;
- coolRanchBreath = userSurveyRating[2];
- coolRanchSurvey[2] = coolRanchSurvey[2] + coolRanchBreath;
- return coolRanchSurvey[3];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement