fork download
  1. //Sam Trivikraman CS1A Chapter 11, p. 647, #9
  2. //
  3. /*
  4.  ******************************************************************************
  5. Store Speaker's Bureau Details
  6. _______________________________________________________________________________
  7. This program stores the speaker's name, phone number, speech topic, and the
  8. speech fee.
  9. _______________________________________________________________________________
  10. INPUT
  11. speaker name : The speaker's name
  12. speaker number : The speaker's phone number
  13. speech topic : The speech topic
  14. speech fee : The fee to attend the speech
  15.  
  16. OUTPUT
  17. array of speech information : An array that stores all of the details for the speech
  18. _______________________________________________________________________________
  19. *******************************************************************************
  20. */
  21.  
  22. #include <iostream>
  23. using namespace std;
  24.  
  25. //a struct that stores all of the information for the Speaker's bureau
  26. struct bureau
  27. {
  28.  
  29. string name; //INPUT The speaker's name
  30. string phoneNum; //INPUT The speaker's phone number
  31. string topic; //INPUT The speech topic
  32. float fee; //INPUT the fee to attend the speech
  33.  
  34. };
  35.  
  36. int main() {
  37.  
  38. bureau speakers[10]; //OUTPUT An array that stores all of the details for the speech
  39.  
  40. //get the information for the speaker and speech from the user
  41. for(int i = 0; i < 10; i++)
  42. {
  43. cout << "Please enter the speaker's name" << endl;
  44. cin >> speakers[i].name;
  45. cout << "Please enter the speaker's phone number" << endl;
  46. cin >> speakers[i].phoneNum;
  47. cout << "Please enter the speech topic" << endl;
  48. cin >> speakers[i].topic;
  49. cout << "Please enter the fee" << endl;
  50. cin >> speakers[i].fee;
  51. }
  52.  
  53. //output the information for the speaker and the speech details
  54. for(int i = 0; i < 10; i++)
  55. {
  56. cout << "Speaker name: " << speakers[i].name << endl;
  57. cout << "Speaker phone number: " << speakers[i].phoneNum << endl;
  58. cout << "Speech topic: " << speakers[i].topic << endl;
  59. cout << "Speech fee: " << speakers[i].fee << endl;
  60. }
  61.  
  62. return 0;
  63. }
Success #stdin #stdout 0.01s 5304KB
stdin
georgie
9495788563
coffee
12
georgie
9495788563
coffee
12
georgie
9495788563
coffee
12
georgie
9495788563
coffee
12
stdout
Please enter the speaker's name
Please enter the speaker's phone number
Please enter the speech topic
Please enter the fee
Please enter the speaker's name
Please enter the speaker's phone number
Please enter the speech topic
Please enter the fee
Please enter the speaker's name
Please enter the speaker's phone number
Please enter the speech topic
Please enter the fee
Please enter the speaker's name
Please enter the speaker's phone number
Please enter the speech topic
Please enter the fee
Please enter the speaker's name
Please enter the speaker's phone number
Please enter the speech topic
Please enter the fee
Please enter the speaker's name
Please enter the speaker's phone number
Please enter the speech topic
Please enter the fee
Please enter the speaker's name
Please enter the speaker's phone number
Please enter the speech topic
Please enter the fee
Please enter the speaker's name
Please enter the speaker's phone number
Please enter the speech topic
Please enter the fee
Please enter the speaker's name
Please enter the speaker's phone number
Please enter the speech topic
Please enter the fee
Please enter the speaker's name
Please enter the speaker's phone number
Please enter the speech topic
Please enter the fee
Speaker name: georgie
Speaker phone number: 9495788563
Speech topic: coffee
Speech fee: 12
Speaker name: georgie
Speaker phone number: 9495788563
Speech topic: coffee
Speech fee: 12
Speaker name: georgie
Speaker phone number: 9495788563
Speech topic: coffee
Speech fee: 12
Speaker name: georgie
Speaker phone number: 9495788563
Speech topic: coffee
Speech fee: 12
Speaker name: 
Speaker phone number: 
Speech topic: 
Speech fee: 0
Speaker name: 
Speaker phone number: 
Speech topic: 
Speech fee: 0
Speaker name: 
Speaker phone number: 
Speech topic: 
Speech fee: 0
Speaker name: 
Speaker phone number: 
Speech topic: 
Speech fee: 8.40779e-45
Speaker name: 
Speaker phone number: 
Speech topic: 
Speech fee: -5.28609
Speaker name: 
Speaker phone number: 
Speech topic: 
Speech fee: 2.8026e-45