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
natka813 [3]
3 years ago
15

Write a do - while loop to get 20 numbers from the user and sum them together. output the sum after the loop. declare any variab

les you need.
Computers and Technology
1 answer:
Lilit [14]3 years ago
8 0
A do while loop in this situation is actually stupid. A for loop or while loop will suit this purpose better, since you do not need to make sure it executes at least once for the given condition. Do while loops are good for situations where the condition may not be true initially, and you'd like to guarantee execution at least once. E.g circular linked list node counter.
You might be interested in
Which are types of online resources that students can use for help? Check all that apply. simulated labs web-based educational g
Korvikt [17]

Answer:

Simulated Labs

Web-Based Educational Games

Discussion Forums

Explanation:

Did a test with the same question.

3 0
3 years ago
Read 2 more answers
TV show information can either keep track of the number of viewers per show or the name of a show. Information is kept in a file
Elza [17]

Answer:

See explaination for Program source code.

Explanation:

The program source code below.

#include <iostream>

#include <fstream>

#include <vector>

using namespace std;

class Show

{

private:

string title;

int viewers;

public:

Show()

{

this->title = "";

this->viewers = 0;

}

Show(string title, int viewers)

{

this->title = title;

this->viewers = viewers;

}

string getTitle(){ return this->title; }

int getViewers(){ return this->viewers; }

};

int main()

{

vector<Show> shows;

vector<string> titles;

vector<int> viewers;

ifstream inFile1("file1.txt");

ifstream inFile2("file2.txt");

string line1, line2;

if(!inFile1.is_open() || !inFile2.is_open())

{

cout << "Either of the files could not be found!\n";

exit(0);

}

getline(inFile1, line1);

if(line1.compare("Show") == 0)

{

while(getline(inFile1, line1))

{

titles.push_back(line1);

}

inFile1.close();

}

getline(inFile2, line2);

if(line2.compare("Viewer") == 0)

{

while(getline(inFile2, line2))

{

viewers.push_back(stod(line2));

}

inFile2.close();

}

for(int i = 0; i < titles.size(); i++)

{

shows.push_back(Show(titles[i], viewers[i]));

}

// display all the show details

cout << "\nALL SHOWS:\n----------\n";

for(Show show : shows)

{

cout << "Title: " << show.getTitle() << ", Number of viewers: " << show.getViewers() << endl;

}

cout << endl;

return 0;

}

See attachment for output

3 0
3 years ago
24/3*2^2/2*3+(20-10)-40
ycow [4]

Answer:

34

Explanation:

You use pemdas

8 0
2 years ago
When parking uphill on a street with no curb, how should your front wheels be positioned? A. Turned to the left (toward the stre
Shkiper50 [21]
The answer is B. It matters which way you park your car . Your car should also be parallel to the carb but with the wheels inward to the right
8 0
3 years ago
Read 2 more answers
Does technology make us more alone?
Anika [276]
Both yeah and no, depending on personal opinion
3 0
3 years ago
Other questions:
  • AMSCO networks plans to conduct a poll of viewers during the SuperBowl. They will conduct analysis to determine which area of th
    6·2 answers
  • The ability to learn a new computer software program is to ____________ as knowledge of state capitals is to _____________.
    11·1 answer
  • Remember for a moment a recent trip you have made to the grocery store to pick up a few items. What pieces of data did the Point
    15·1 answer
  • Benjamin recently issued new mobile phones to the marketing team at his company. Each phone can transmit encrypted information f
    8·1 answer
  • Write a program that prompts the user to enter a number then counts the number of odd numbers and even numbers the user enter. T
    15·1 answer
  • How will Mario know which words are misspelled in his document?
    11·2 answers
  • How do I get the bot token for discord? (scripting etc)
    5·1 answer
  • True or False? A website for a certain political party or candidate is likely to have unbiased information.
    11·2 answers
  • Write Epic username plz
    6·1 answer
  • What service determines which resources a user can access along with the operations that a user can perform?.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!