Lab 00 - Hello World


Description

"Create a C++ program to verify the web submission process for your labs."

Learning Outcomes

By completing the Hello Lab, you will have:


Preparation

Install Visual Studio Community 20xx on your computer.

Documentation and installation steps for Windows Visual Studio 20xx can be found here.


The Lab

Use the following steps in creating your lab:

  1. Run Visual Studio Community and create an empty project.
  2. Add the following C++ .cpp file (or write your own) to your project:

    #include <iostream>
    #include <fstream>
    #include <string>
    using namespace std;
    
    #ifdef _MSC_VER
    #define _CRTDBG_MAP_ALLOC  
    #include <crtdbg.h>
    #define VS_MEM_CHECK _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
    #else
    #define VS_MEM_CHECK
    #endif
    
    /**	Write input file lines (as specified by argv[1])
    	to output file (as specified by argv[2]).
    */
    int main(int argc, char* argv[])
    {
       VS_MEM_CHECK                        // enable VS check for memory leaks
    
       if (argc < 3) return 3;
       ifstream in = ifstream(argv[1]);    // open argv[1] for input
       if (!in) return 1;
       ofstream out = ofstream(argv[2]);   // open argv[2] for output
       if (!out) return 2;
    
       // read input file lines and send to output file
       for (string line; getline(in, line);)
       {
          out << line << endl;
       }
    
       // **LEAK SOME MEMORY - REMOVE FOR FULL CREDIT**
       int* memory = new int(100);
    
       return 0;
    }

  3. Set breakpoint on return statement to verify message.
  4. Compile and execute.
  5. Zip your hello.cpp file.
  6. Submit the .zip folder and verify auto-grader results.

Hello World Grading Criteria

Instructions for submitting your lab:

Use the following test input and resulting output files in testing your Hello World lab.

Input FileOutput File
Test #1 lab00_in_01.txt lab00_out_01.txt
Test #2 lab00_in_02.txt lab00_out_02.txt

 

The auto-grader will grade your lab as follows:

Fail
Pass
Score = 0

 

There is no peer review for this lab. However, if there were a peer review, the following rubric would be used:

No
Partial
Yes
Score = 0
Overall
Rating
Easy to follow, readable, organized, and well commented.
                      
***NOTE: Any attempt to circumvent any lab requirement (ie, hard coding
output, using loops instead of iterators where required, modifying a class interface, etc.) will be reported by peer reviewers and result in a zero score for the lab.
Total Score = 0