summaryrefslogtreecommitdiffstats
path: root/C++/Arrays/instructions
blob: d09b59d7ca9d8cb73f34ec94ce4d48d211d80547 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

Project 1: Files, Functions and Arrays
Due: Friday, August 26th, 2022 before midnight
100 Points
Problem Statement:
Create a program that reads in an unknown number of college-name class names (such as Programming 2) from an input file (see explanation of unknown number below). Then, output those class names to both the screen and an output file - output once in the order in which the data was read in from the file and again in reverse order.
Step-by-step instructions:

    Create an array variable to store string values. Make this array variable so it can store up to 50 values in it. When declaring that array variable, use a constant int to allocate the size.
    Create an input file variable to read in the class name data. Create an output file variable to store output
    Use a loop of your choice to read in an unknown number of values from your input file and store that data into the array variable you created in step 1 (unknown number values: this means the number of data items stored in the file size is not static. It can change each time the program executes)
    Use getline to read in string values from your input file so you may capture values with spaces in them
    After reading in the class names from the input file and storing them into your array variable, output them to both the screen and an output file in the original order and again in reverse order
    Use functions to do the following: 
        Check to see if the file was found
        Read in the class names
        Output the class names to the screen in the original order
        Output the class names in reverse order
        Close the files

Be sure to use comments in your program: Name, Program Description, Date and anywhere else in the program you deem necessary.
***NOTE*** Here is an explanation of unknown number of records - Example: Let's say we want to read in from an input file the names of students attending class each class day. The number of students attending class varies because students sometimes miss class. Therefore, we do not know how many names will be read into our program when we take roll. Therefore, we need to build our system to handle this issue. In the assignment I asked you to create, you do not know how many class names will be inside of the input file. It could be 2 or 5 or 20. We don't know. So, you will need to write you program to handle this problem. Ths is simply using a while loop to read until the end of file is reached. I discuss how to do this in the video lectures on files. The only real problem is if the number of records read in from the input file exceeds the the array allocation. Example: string classNames[10]; and I try to read in 20 class names. This is not possible. To prevent this issue, you need to set your allocation to a value that likely be higher so this issue does not occur.  
If you are stuck, no worries. I will help in class and through email.  
Grading Rubric:

    If you do not include comments at the top of the program (name, program description, date), you will lose 15 points
    If you do not use functions, you will use 10 points per missing function (50 points possible)
    If your program does not compile (run), then I will give a grade of 0/100. But will give you the change to repair for points back (some points are better than none)
    If your program is late (within 48 hours of the due date), you will lose 25 points
    If your program is not formatted nicely (code all over the place, ugly), you will lose up to 25 points depending on the severity
    If your program stops working when I run it, you will lose points. The amount depends on the severity of the error
    If your program is identical to another student's work, I will contact both students for a conference where you may both receive a 0/100 for your project
    If your program looks like a a professional programmer wrote it, I will contact you to determine if you did indeed write the program or copy off of the internet, you may receive a 0/100 for copying 
    This is just a list of typical issues I run into when grading to give you some idea of where your points go. Points can be taken off for other reasons.