Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4025478
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:51:07+00:00 2026-05-20T10:51:07+00:00

I am stuck on the last few problems of an array exercise. Could anyone

  • 0

I am stuck on the last few problems of an array exercise. Could anyone lend a hand?

Write C++ statements that do the following:

  1. store 5 in the first column of an array and make sure that the value in each subsequent column is twice the value in the previous column.

  2. print the array one row per line.

  3. print the array one column per line.

I think this will work for question #2:

for (row = 0; row < 10; row++)
     {
         for (col = 0; col < 20; col++)
             cout << alpha[row][col] << " ";

             cout << endl;
     }     

but question 1 and 3 have me stumped. thanks

Here’s what i came up with after your tips. thanks everyone

3.

for (col = 0; col < 20; ++col)
     {
         for (row = 0; row < 20; ++row)
             cout << alpha[row][col] << " ";

             cout << endl;
     }     

1.

for (row = 0; row < 10; row++)
   alpha[row][0] = 5;

   for (col = 1; col < 20; col++)
       for (row = 0; row < 10; row++)
       alpha[row][col]=alpha[row][col-1]*2;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:51:08+00:00Added an answer on May 20, 2026 at 10:51 am

    For #1, run a loop that starts at zero and goes until the number of rows. In each iteration just assign 5 to array[row][0]=5 (since coloumn 0 is the first coloumn).

    Now run a loop from 1 to the number of coloumns. Inside, run another loop for each row. just assign array[row][col]=array[row][col-1]*2.

    For #3, simply reverse the order of the loops. We iterate over all coloumns, and for each coloumns we have to iterate over all rows and print a newline after that.

    I would post code, but it is better for you to try to understand and write the code yourself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been stuck using .Net 2.0 for the last few years and have only
I'm having some serious problems last few days with one part of my application.
I have been stuck for the last couple of days deploying a standard WAR
I almost have this Powershell script completed but I am stuck at the last
I'm converting a code from C to Delphi, but I'm stuck on the last
I am stuck with facebook authentication for the last 5 hours now and I
I am stuck here and i spend last 2 days resolving this issue but
I've been stuck with this simple Sql query for last 3 hours and my
H e l l o Everyone, after installing the last Xcode 4.3.1 I stuck
I've been learning ggplot in the last few weeks. Generally, I'm getting things done

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.