Question: Each of the program segments in this section has errors. Find as many as you can. // This code should use a loop to raise

Each of the program segments in this section has errors. Find as many as you can.

// This code should use a loop to raise a number to a power.

int num, bigNum, power, count;

cout << "Enter an integer: ";

cin >> num;

cout << "What power do you want it raised to? ";

cin >> power;

bigNum = num;

while (count++ < power);

bigNum *= num;

cout << "The result is << bigNum << endl;

segment 2 :

// This code should average a set of numbers.

int numCount, total;

double average;

cout << "How many numbers do you want to average? ";

cin >> numCount;

for (int count = 0; count < numCount; count++) {

int num;

cout << "Enter a number: ";

cin >> num;

total += num;

count++;

}

average = total / numCount;

cout << "The average is << average << endl;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!