Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, for this question I just want to see if I got right the steps of my C++ program. Below are the steps and the

Hi, for this question I just want to see if I got right the steps of my C++ program. Below are the steps and the code. Thanks.

image text in transcribed

image text in transcribed

image text in transcribed

#include

using std::cout;

using std::cin;

using std::endl;

int readArray(int, int[]);

int main()

{

const int MAX_SCORE = 50;

int score[MAX_SCORE];

int nScores = 0;

cout

nScores = readArray(MAX_SCORE, score);

cout

system("pause");

return 0;

}

int readArray(int MAX_SIZE, int arrayToBeFilled[])

{

int nEntries = 0;

for (int i = 0; i

{

char buf[100];

cin >> buf;

arrayToBeFilled[i] = atoi(buf);

if (arrayToBeFilled[i] 100)

{

i -= 1;

continue;

}

else if (buf[0] == 'q' || buf[0] == 'Q')

break;

else

nEntries++;

}

return nEntries;

}

LAB 6: Working With Arrays [ Array.cpp ] STEP 1 of 5: Create And Fill An Array Write the Array.cpp program as listed below. It uses an array to store up to 50 test scores from the keyboard. Scores are integer numbers as low as O, and up to and including 100. Note that the program reads console input directly into a numeric variable. Run this, and see what happe if you enter text when prompted for numeric input -- it's not pretty! Remember that our convention is to not read numerics directly into cin. Be sure to follow all of the programming conventions for this course, even if they are not followed in the sample code provided in this writeup! #include using std::cin; using std::cout; using std::endl; int main() const int MAX-SCORE- 50; // the maximum #of scores that a user can enter int score[MAX SCORE]; 1/ create storage for up to 50 scores int nscores = 0; // count the number of scores entered /1 read the scores from the keyboard, space and/or newline delimited for (int i = 0; i > score[il; if (score[i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

Students also viewed these Databases questions

Question

2. Discuss the types of messages that are communicated nonverbally.

Answered: 1 week ago

Question

3. Develop a case study.

Answered: 1 week ago