Skip to main content

Posts

Showing posts from December, 2008

PRACTICE QUIZ

1. Write an m-file program that reads in quiz scores one at a time, calculates the average score, and counts the number of quizzes that score i) less than or equal to 50, ii) over 50 and less than or equal to 75, and iii) over 75 and less than or equal to 100. Your program should do the following: a. Prompt the user “Enter quiz score or 999 to end” b. Increment n_50 , n_75 , or n_100 c. Prompt the user again “Enter quiz score or 999 to end” d. If the user enters 999 for the quiz score, the program should calculate the high score, the low score, and the average score and print out: Quiz average score = uu.uu Highest score = hh Lowest score = ll Number of scores under 50 = xx Number of scores between 50 and 75 = yy Number of scores between 75 and 100=zz and end. (“ xx ,” “ yy ,” and “ zz ” are the actual number of quizzes in each category) f. Have your program plot the score vs. the exam number (first exam: n=1, second exam: n=2, etc.) as below.

Directions for using Microsoft Visual C++ 2008 Express Edition:

1. Open the Program Entry Screen: 2. Once at the entry screen, look towards the upper left portion of the screen in the “Recent Project” window. Click on “Create: Project” 3. A window will open with some choices in it. Choose “Win32 Console Application,” as the screen with the black background you usually work in is called the console. Window: Click Here 4. Name the project in the “Name:” text box 5. Click “OK.” This brings up the project wizard. Click “Finish” Name Project here 6. This will bring you to a standard .cpp file with the name “PROJECT_NAME.cpp” if you named it “PROJECT_NAME” 7. Some of the included header files or formats may look strange, but don’t delete them! The computer puts them there to support the Microsoft .NET framework. Just header files like you normally would. a. For example, insert “#include ” (notice no .h) 8. Don’t change the main function format either. Just insert your code into the main function brackets. 9.