answer.
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
NISA [10]
2 years ago
7

Write a C++ program that uses a while statement and the tab escape sequence \t to print the following table of values:N 1 0*N 1

00*N 1 000*N1 1 0 1 00 1 0002 20 200 20003 30 300 30004 40 400 4000
5 50 500 5000
Computers and Technology
1 answer:
Luda [366]2 years ago
5 0

Answer:

#include <iostream>

using namespace std;

int main()

{

cout << "N\t10*N\t100*N\t1000*N" << endl;

int x=1;

while(x<=5){

 cout << x <<"\t"<< x*10 <<"\t"<<x*100  <<"\t"<< x*1000 << endl;

 x++;

}

   return 0;

}

Explanation:

Print the header, N 10*N 100*N 1000*N, using \t

Initialize the x as 1. It will be used to control the while loop

Create a while loop that iterates while x is smaller than or equal to 5

Inside the loop, print the required values. After printing, increment the value of x by 1

You might be interested in
You are consulting for a trucking company that does a large amount ofbusiness shipping packages between New York and Boston. The
likoan [24]

Answer:

Answer explained with detail below

Explanation:

Consider the solution given by the greedy algorithm as a sequence of packages, here represented by indexes: 1, 2, 3, ... n. Each package i has a weight, w_i, and an assigned truck t_i. { t_i } is a non-decreasing sequence (as the k'th truck is sent out before anything is placed on the k+1'th truck). If t_n = m, that means our solution takes m trucks to send out the n packages.

If the greedy solution is non-optimal, then there exists another solution { t'_i }, with the same constraints, s.t. t'_n = m' < t_n = m.

Consider the optimal solution that matches the greedy solution as long as possible, so \for all i < k, t_i = t'_i, and t_k != t'_k.

t_k != t'_k => Either

1) t_k = 1 + t'_k

    i.e. the greedy solution switched trucks before the optimal solution.

    But the greedy solution only switches trucks when the current truck is full. Since t_i = t'_i i < k, the contents of the current truck after adding the k - 1'th package are identical for the greedy and the optimal solutions.

    So, if the greedy solution switched trucks, that means that the truck couldn't fit the k'th package, so the optimal solution must switch trucks as well.

    So this situation cannot arise.

  2) t'_k = 1 + t_k

     i.e. the optimal solution switches trucks before the greedy solution.

     Construct the sequence { t"_i } s.t.

       t"_i = t_i, i <= k

       t"_k = t'_i, i > k

     This is the same as the optimal solution, except package k has been moved from truck t'_k to truck (t'_k - 1). Truck t'_k cannot be overpacked, since it has one less packages than it did in the optimal solution, and truck (t'_k - 1)

     cannot be overpacked, since it has no more packages than it did in the greedy solution.

     So { t"_i } must be a valid solution. If k = n, then we may have decreased the number of trucks required, which is a contradiction of the optimality of { t'_i }. Otherwise, we did not increase the number of trucks, so we created an optimal solution that matches { t_i } longer than { t'_i } does, which is a contradiction of the definition of { t'_i }.

   So the greedy solution must be optimal.

6 0
2 years ago
The attack in which the attacker sends a forged packet with the same source IP address and destination IP address in which the v
Sergeeva-Olga [200]

Answer:

TEARDROP

Explanation:

Teardrop is a form of attack in which the attacker sends a forged packet with the same source IP address and destination IP address in which the victim may be tricked into sending messages to and from itself .

Teardrop attack also involves sending fragmented packets to a target machine in which the victim is been tricked into sending messages to and from itself. One of the fields in an IP header is the “fragment offset” field, indicating the starting position of the data contained in a fragmented packet relative to the data in the original packet.

7 0
2 years ago
A good way to avoid skids is to _____ when coming into a turn. A. accelerate B. decelerate C. counter steer D. cover brake
lord [1]

Answer:

B decelerate

Explanation:

Deceleration will help in avoiding you from loosing control of the vehicle

3 0
1 year ago
Read 2 more answers
Assume that month is an int variable whose value is 1 or 2 or 3 or 5 ... or 11 or 12. Write an expression whose value is "jan" o
Tamiku [17]

Answer:

The code is given below

Explanation:

The correct syntax would be to place appropriate parenthesis.

(month==1?"jan":(month==2?"feb":(month==3?"mar":(month==4?"apr":(month==5?"may":(month==6?"jun":(month==7?"jul":(month==8?"aug":(month==9?"sep":(month==10?"oct":(month==11?"nov":"dec")))))))))));

Similarly, you can also use the following code:

String[] months = { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" };

int month = 1;

String monthDescription = months[month - 1];

7 0
1 year ago
Your computer has gradually slowed down. What's the most likely reason?
sweet-ann [11.9K]
It could be old ... could be your connection to the internet... could be a virus. You can go to walmart or your super store and buy a usb for your computer. There are ones that can speed up your computer. I had to buy it for mine and it worked. It might be over 20 dollars depends on where you go.
8 0
2 years ago
Other questions:
  • Sharon reads two different articles about avocados. The first article, in a weight loss magazine, claims that avocados are unhea
    10·2 answers
  • What will be the output of “AAAAMMMMMHHHVV” using a file compression technique?
    9·2 answers
  • Explain how abstraction is used in a GPS system
    12·2 answers
  • In cell B16, enter a function to calculate the total attendance for the years 2014 through 2018 using the totals in the range B1
    10·1 answer
  • A U.S. social security number consists of a string of 9 digits, such as "444422333". Assume that input consists of a sequence of
    6·2 answers
  • Assume the input data is structured as follows: first there is a non-negative integer specifying the number of employee timeshee
    9·1 answer
  • I need to write a really simple python program to solve this issue. I have most of the program written but, when I run the secon
    8·1 answer
  • Sara is having a tough time finding the cause of a problem on a computer she is troubleshooting. She found a possible problem bu
    15·1 answer
  • Write code that determines the number of full days represented by the number of hours stored in the variable hours and stores th
    15·1 answer
  • Two devices are connected to the Internet and communicating with one another. A squirrel chews through one of the wires in the n
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!