Question

In: Computer Science

needs to be done in C++ Q6. Coding Question (you must code this problem and submit...

needs to be done in C++

Q6. Coding Question (you must code this problem and submit via Blackboard):

Keep everything as Integers.

Row and Column Numbering starts at 1.

Equation for each Cell :   Coll = (Row * Col * 10)

Using Nested Loops display the following exactly as it is shown below:

                                 Columns %

Brand         1           2         3          4          

    A            10         20       30       40     

    B            20         40        60       80      

    C            30         60        90     120     

   D            40         80      120     160     

Solutions

Expert Solution


#include <iostream>

using namespace std;

int main()
{
    int Col,Row,Coll,n=5;
    cout<<"\t\tColumns%"<<endl;   //To display Columns%
    cout<<"Brand\t";             //display Brand
    for(Row=1;Row<=n;Row++)
    cout<<Row<<"\t";            //To print 1,2...4 in 2nd row
    cout<<endl;
    for(Row=1;Row<=n;Row++)    //Row value varies from 1 to 4
    {
        cout<<char('A'+(Row-1))<<"\t"; //To display A,B,C,D.
      //ascii value of A is added to (Row-1) and converts to char.
        for(Col=1;Col<=n;Col++)    //Col value varies from 1 to 4
        {
            Coll=(Row * Col * 10);    //calculate cell value using given formuala
            cout<<Coll<<"\t";
        }
        cout<<endl;
    }

    return 0;
}

Working of nested loop, n=4

for(Row=1;Row<=n;Row++)    //Row value varies from 1 to 4

    { for(Col=1;Col<=n;Col++)    //Col value varies from 1 to 4

        {

            Coll=(Row * Col * 10);    //calculate cell value using given formuala

            }

     }

Row=1

ROW

1

1

1

1

COLUMN

1

2

3

4

CELL VALUE

1*1*10=10

1*2*10=20

1*3*10=30

1*4*10=40

ROW=2

ROW

2

2

2

2

COLUMN

1

2

3

4

CELL VALUE

2*1*10=20

2*2*10=40

2*3*10=60

2*4*10=80

ROW=3

ROW

3

3

3

3

COLUMN

1

2

3

4

CELL VALUE

3*1*10=30

3*2*10=60

3*3*10=90

3*4*10=120

ROW=4

ROW

4

4

4

4

COLUMN

1

2

3

4

CELL VALUE

4*1*10=40

4*2*10=80

4*3*10=120

4*4*10=160


Related Solutions

Use Excel to complete the following question. You must submit/attach all work done in Excel in...
Use Excel to complete the following question. You must submit/attach all work done in Excel in order to receive full credit. 5. A health advocacy group conducted a study to determine if the nicotine content of a particular brand of cigarettes was equal to the advertised amount. The cigarette brand advertised that the average nicotine content per cigarette was 1.4 milligrams. The advocacy group randomly sampled 24 cigarettes. The nicotine level for each of the sampled cigarettes is given below....
(MUST BE DONE IN C (NOT C++)) In this task, you will create a structure with...
(MUST BE DONE IN C (NOT C++)) In this task, you will create a structure with arrays. You will have to create your own structure. However, make sure to meet these guidelines: - Give the structure whichever name you want. - It must have at least 3 members. - Two of the members must be arrays. - Your members should be of at least two different data-types. In other words, your members cannot be integers only (or floats, or doubles…)....
Simple code for a game on C coding.
Simple code for a game on C coding.
(MUST BE DONE IN C (NOT C++)) In this task, you will have to make sure...
(MUST BE DONE IN C (NOT C++)) In this task, you will have to make sure you understood the concept of “the dot” in programming. Go ahead and declare an array of characters with a default length (whichever length you want, it's fine). Next, you want to ask the user for a phrase and store the characters in your array, but before you do that, ask the user for an estimated length of the array. If the length given is...
This problem needs to be solved with source code. I need a C++ program that will...
This problem needs to be solved with source code. I need a C++ program that will help me solve this question. I need it in C++, please. Writing with comments so it maybe cleared. 1.2. We received the following ciphertext which was encoded with a shift cipher: xultpaajcxitltlxaarpjhtiwtgxktghidhipxciwtvgtpilpit ghlxiwiwtxgqadds. 1. Perform an attack against the cipher based on a letter frequency count: How many letters do you have to identify through a frequency count to recover the key? What is...
***This problem must be done using R so please provide the R code used to find...
***This problem must be done using R so please provide the R code used to find the solution. I have provided the data in data-wtLoss.txt below the question. I will also give "thumbs-up for correct R code" Thanks in advance.*** The file “data-wtLoss.txt” contains data on weight loss and self esteem evaluation at three time points over a period of three months for 34 individuals who are randomly selected from a residential area. These individuals are randomly assigned to one...
***This problem must be done using R so please provide the R code used to find...
***This problem must be done using R so please provide the R code used to find the solution. I have provided the data in data-wtLoss.txt below the question. I will also give "thumbs-up for correct R code" Thanks in advance.*** The file “data-wtLoss.txt” contains data on weight loss and self esteem evaluation at three time points over a period of three months for 34 individuals who are randomly selected from a residential area. These individuals are randomly assigned to one...
please submit the C code( no third party library). the C code will create output to...
please submit the C code( no third party library). the C code will create output to a file, and iterate in a loop 60 times and each iteration is 1 second, and if any key from your keyboard is pressed will write a 1 in the file, for every second no key is pressed, will write a 0 into the output file.
write a code for a typing game in plain C coding.
write a code for a typing game in plain C coding.
Write assembler code to print even numbers from 1-20. Submit code and screenshot. I am coding...
Write assembler code to print even numbers from 1-20. Submit code and screenshot. I am coding in NASM on a SASM system.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT