Lab #6 PA2 Prep and Visual Studios Solution





  • Use Visual Studios to compile a program with multiple files
  • Provide an outline for CSCI 1410 PA2

Development Environment: all students must use Visual Studios 2015

Skills: compilation of multiple files in Visual Studios, while loops, functions with multiple files, arrays, structs, use of random variables. (note: arrays, structs just from an English Psuedocode, since we haven’t studied yet).

Reading: CSCI 1410 PA2 Prep/CSCI 1410 PA2

Deliverables: 1) This lab with two screen shots 2) lastnameFirstLab06.cpp

Part I – Skills Practice (10 points)

  • From a Windows lab machine, click into the Visual Studios 2017
  • Open a new project called lab06

  • Click Next (Not Finish)

  • Click on Next then Uncheck the precompiled header and Security Development Lifecycle. This is important, otherwise the code will not compile on a non-Visual Studios compiler. Check the Empty project box

  • Go to View->Solution Explorer
  • Right Click and Remove->Permanently Delete the stdafx.h, targetver.h, Lab06.cpp, stdafx.cpp files (if you did not check the empty project box)
  • Right Click on Lab06->Open Folder in File Explorer
  • Copy the lastnamefirstlab05.cpp, functions.h, and functions.cpp from Lab05 into this folder.
  • Right Click on Header Files->Add->Existing Item. Add the functions.h
  • Right Click on Source Files->Add->Existing Item. Add the lastnamefirstlab05.cpp, and the functions.cpp files
  • (You could also Right Click->Add->New items as well. If you do this, delete any of the existing text and start from scratch).
  • Provided you did lab05 correctly, you should be ready to compile this.
  • Go to Build->Build Solution
  • You should get an output screen that says succeeded. If it fails, perhaps you didn’t change some of the items back for lab05. You can double click on the file names to view and edit the code.
  • Now go to Debug->Start without Debugging. Run with 32 degrees Fahrenheit. Note if you don’t close out the screen or hit return at the end, there will be another windows terminal open.
  • Place a screenshot of the output below.
  • Note: If you were to use or create a text file, you would right click on the Resource Files and place Add or New. These files should again, be placed in the same directory as your .cpp and .h files.

Part II – More Skills (5 pts)

Write a program that asks the user how many random numbers and the maximum random number. Then it prints these out and prints out the average of these numbers. Hint: You know how many random numbers so that probably calls for a specific type of loop. Write this program in Visual Studios. Use for reference. You will use srand ONLY once, then use rand() with the modulus operator (%) to get a number between 0 and size -1

  • Take a screen shot of the results and place it below.

Part III – outline/pseudo-code/algorithms (10 pts)

  • Work alone to write the pseudo-code and outline for CSCI 1410 Programming Assignment 2. Note that we haven’t yet gone over arrays or structs, but you can put in plain English what you are expecting to do. You may (and should) discuss ideas with your lab partner, but each of you must provide your own outline. If you use any major concepts from someone other than your instructor, you must list it under the Lab Partner section.