1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
enyata [817]
3 years ago
9

Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards

, then backwards. End each loop with a newline. Ex: If courseGrades = {7, 9, 11, 10},
print:
7 9 11 10
10 11 9 7

Hint: Use two for loops. Second loop starts with i = NUM_VALS - 1.

#include

int main(void) {
const int NUM_VALS = 4;
int courseGrades[NUM_VALS];
int i = 0;
courseGrades[0] = 7;
courseGrades[1] = 9;
courseGrades[2] = 11;
courseGrades[3] = 10;

/* Your solution goes here */
return 0;
}
Computers and Technology
1 answer:
konstantin123 [22]3 years ago
4 0

Answer:

for(i = 0 ; i < NUM_VALS; ++i)

{

   cout << courseGrades[i] << " ";

}

cout << endl;

for(i = NUM_VALS-1 ; i >=0 ; --i)

{

   cout << courseGrades[i] << " ";

}

cout << endl;

Explanation:

The first loop initializes i with 0, because we have to print the elements in order in which the appear in the array. We print each element, adding a space (" ") character at its end. After the loop ends, we add a new line using endl.

The second loop will print the values in a reverse order, so we initialize it from NUM_VALS-1, (since NUM_VALS = 4, and array indices are 0,1,2,3). We execute the loop till i >= 0, and we print the space character and new line in a similar way we executed in loop1.

You might be interested in
Southern States<br> Wanted...<br> But...<br> So...
Dvinal [7]
The southern states wanted slavery, but the northern did not, so they had a civil war. :P
8 0
3 years ago
Why is my computer fans making weird noises?
sattari [20]

Answer:

The biggest culprit for excess noise in computers Computer internal devices all generate "heat."  Most computers manufacturer add temperature controller fans on important internal devise or locations.  These will spin faster when "hot" temperatures are detected.  With the fans, there are usually "ventilation holes" needed to push this hot "air" out.  Unfortunately, these holes let in dust and "other debris' into the fans, thus making them "spin" harder and faster. This is normal. You might want to take your computer to your school's office and ask them about your. computer. I think I have a solution below but I am not sure it will work.

Check to make sure that your computer is set to use all of your speakers. Navigate to the Control Panel, and double-click Sounds And Audio Devices. If you change this setting, click Apply, OK, and then OK again to exit the Sounds And Audio Devices Properties dialog box.

Hope this answer helped you have a good day.  :)

3 0
2 years ago
Read 2 more answers
Complete the following sentences with the correct form of the verbs in brackets.
Rina8888 [55]

Answer:

1. don't pass, will be

2. will get, eat

3. don't help, won't help

4. are meeting, will you go?

5. will stay, rains

Is

6.Will

Puts on

7.Will go

Asks

8.Will... tell

9.Tell

Will

10.Go... Will find out...

Explanation:

5 0
2 years ago
Consider the classes below, declared in the same file: class A { int a; public A() { ​ a = 7; } } class B extends A { int b; pub
DiKsa [7]

Answer:

2. <em>A reference of type A can be treated as a reference of type B</em> - False

Base class or its objects are not related to their derived class (or its objects).

Explanation:

class A {

   int a;

   public A() {

       a = 7;

   }

}

class B extends A {

   int b;

   public B() {

       b = 8;

   }

}

///////////////////////////////////////////////////////////////////////////////////////////////////////

1. <em>After the constructor for class B executes, the variable a will have the value 7 </em>- True.

When an object of a derived class is declared, the constructor of base class is called before the constructor of derived class (is called).

3. <em>Both variables a and b are instance variables </em>- True.

Classes can have instance, or member, variables and methods.

4.<em> After the constructor for class B executes, the variable b will have the value 8</em> - True.

When object of class B is declared, its constructor was called, which initialized variable b to 8.

4 0
3 years ago
What keyword can we use within a form to pass it as an argument to a JavaScript snippet? A. form B. onSubmit C. send D. this
astraxan [27]

C. send is your answer

3 0
2 years ago
Read 2 more answers
Other questions:
  • Which of the following is not a typical step in the ethical hacking process? A. Planning B. Discovery C. Attack D. Recovery
    5·1 answer
  • What is an additional clock tab
    11·1 answer
  • Karen thinks she should go out with Blane, an unattractive, social misfit, because “If I don’t go out with him, people will thin
    7·1 answer
  • Write the sql command to show which tutor needs to be reminded to turn in reports.
    13·1 answer
  • Which of the following is true regarding packaged software and custom software? Group of answer choices Packaged software are ap
    13·1 answer
  • What is an orthochromatic film?
    12·1 answer
  • What help in executing commands quickly
    5·1 answer
  • Explain how a stored procedure is processed by the DBMS query processor (including the type of return value after the query is p
    15·1 answer
  • What are some legal issues that can arise from the use of social media?
    10·1 answer
  • Energy/power management systems, kitchen appliances, smart televisions, baby monitors, fitness trackers, and personal health mon
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!