The purpose of this lab is to review cmps2010 material on the topics of arrays, functions, pointers, and dynamic memory allocation. For this lab, you will take the given main function and code the missing function definitions to perform as described in the given incomplete code.
How many tests scores do you want to enter? 2 Enter test score: -1 Invalid test score Enter test score: 101 Invalid test score Enter test score: 100 Enter test score: 99 Test Score #1: 100 Test Score #2: 99 Average Test Score: 99.50 Enter new series of test scores? (yes/no) yES How many tests scores do you want to enter? 3 Enter test score: 90 Enter test score: 80 Enter test score: 75 Test Score #1: 90 Test Score #2: 80 Test Score #3: 75 Average Test Score: 81.67 Enter new series of test scores? (yes/no) no
//Lab 1 cmps2020 #include<iostream> //cin,cout #include<iomanip> //setprecision #include<cstring> //strlen,strcpy,strcat,strcmp #include<cctype> //isalpha,isdigit,isupper,toupper,etc #include<cstdlib> //exit using namespace std; #define MAX 10 int main() { int count, *tests = nullptr; float avg=0; char response[MAX]; do { do { cout << "How many tests scores do you want to enter? "; cin >> count; }while(!isPositive(count)); // need to define tests = allocate(count); // need to define if(tests!=nullptr) { inputTestScores(tests,count); // need to define avg = calcTestAvg(tests, count); // need to define displayTestResults(tests, count, avg); // need to define deallocate(tests); // need to define } else { cout << "bad allocation \n"; exit(1); } cout << "Enter new series of test scores? (yes/no) "; cin.ignore(256,'\n'); cin.getline(response, MAX); convertToLowerCase(response, strlen(response)); // need to define }while(!strcmp(response, "yes")); }
In addition, you will send me an email with the following content.
To :derrick@cs.csubak.edu
Cc :
Attchmnt:
Subject :2020 lab1
----- Message Text -----
What is your first and last name?
What is your sleipnir username?
Which 2010 concept was most challenging for you?
What will you do to improve your programming skills?
What can I do to help improve your programming skills?
Congratulations, you've completed this lab. Raise your hand to show me that you've completed or have the source code in the depository directory: /2020_S19/wk1/lab1.cpp
To setup your depository directory, follow the instruction HERE.