Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. // This program demonstrates the use of characters and strings
  2.  
  3. // Dean DeFino
  4.  
  5. #include "pch.h"
  6. #include <iostream>
  7. #include <string>
  8. using namespace std;
  9.  
  10. // Declaration of constants
  11. const string FAVORITESODA = "Dr. Dolittle"; // use double quotes for strings
  12. const char BESTRATING = 'A'; // use single quotes for characters
  13.  
  14. int main()
  15. {
  16. char rating = 'B'; // 2nd highest product rating
  17. string favoriteSnack; // most preferred snack
  18. int numberOfPeople; // the number of people in the survey
  19. int topChoiceTotal; // the number of people who prefer the top choice
  20.  
  21. favoriteSnack = "crackers";
  22. rating = 'B';
  23. numberOfPeople = 250;
  24. topChoiceTotal = 148;
  25.  
  26. cout << "The preferred soda is " << FAVORITESODA << endl;
  27. cout << "The preferred snack is " << favoriteSnack << endl;
  28. cout << "Out of " << numberOfPeople << " people "
  29. << topChoiceTotal << " chose these items!" << endl;
  30. cout << "Each of these products were given a rating of " << BESTRATING;
  31. cout << " from our expert tasters" << endl;
  32. cout << "The other products were rated no higher than a " << rating
  33. << endl;
  34.  
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement