SHARE
TWEET

Untitled

a guest Mar 20th, 2017 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. C++ Program
  2. Write a program that accepts the following input from the keyboard:
  3. -a first name
  4. -a last Name
  5. -The scores on three tests (scores will range from 0 to 10). They type should be double
  6. The program will calculate the average of the three scores entered from the keyboard
  7. and store the average as a rounded integer (ex. If the average is 7.57 then it will be
  8. stored as 8, but if it was 6.49, then it will be stored as 6)
  9. Then, using the rounded average calculate the corresponding course letter grade using
  10. the scoring system below. You must use a switch statement to get the letter grade.
  11. The simplified scoring system will be:
  12. 9-10 A
  13. 8 B
  14. 7 B6
  15. C+
  16. 5 C
  17. 4 D+
  18. 0-3 F
  19. Once all of the data has been processed (entered, stored and average and letter grades
  20. have computed) display on your monitor (cout) the results in the following way:
  21. The dashes were produced by adding setfill('-') to the output.
  22. Once you are satisfied that your output is correct and properly lined up, send the same
  23. output to a file. Use “example.txt” as the file name. The file will be created in the same
  24. directory as your program. You can use File/Open in Dev-C++ to access that directory
  25. (i.e. folder) and see if the contents of the file match what you displayed on your
  26. monitor. They should!!!
  27. To find more about how to output to files, read pages 160-161 (File input output).
  28. There you will see how to create a file for output (and input, but this time we will do
  29. only output). Once you have created the file stream associated with file example.txt,
  30. you can output to that file stream the same as you do to cout. In fact, you can think of
  31. cout as a file stream associated with your monitor, instead with a real file on disk.
  32. In order to make all the above work you need to include:
  33. #include <iostream>
  34. #include <fstream>
  35. #include <string>
  36. #include <iomanip>
  37. using namespace std;
  38. It is important that you name the output file as I indicated (“example.txt”), since when I
  39. run your program I will expect it to create a file of the same name on my computer that
  40. I will have to check to make sure your output is correct.
RAW Paste Data
Top