Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,991 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,335 people online right now. Registration is fast and FREE... Join Now!




Arrays

 
Reply to this topicStart new topic

Arrays

janet
4 Dec, 2006 - 07:56 PM
Post #1

New D.I.C Head
*

Joined: 4 Dec, 2006
Posts: 3


My Contributions
Okay, I have been working on this program for about a week now. I can't seem to figure out how to get this to look like I want it to.

This is a 2-dimensional array with 2 rows and 12 columns.

CODE

const int cMax_Rows = 2;
const int cMax_Cols = 12;

using namespace std;

void getdata (int table[] [cMax_Cols])
{
     for (int row = 0; row < 1; row++)
      for (int col = 0; col < cMax_Cols; col++)
      {
          cout << " Enter high temperature for each month";
          cin >>  table [1][col];
        
          }
      return;
}


I want the output to look like this:
Enter high temperature for each month
(with the 12 integers under here)
The second row is for low temps, but I want to figure out the first part before I go to the next.

My output right now looks like this:
Enter high temperature for each month (int enter)
Enter high temperature for each month (int enter)
and so on for the 24 inputs.

Any help is greatly appreciated.

This post has been edited by Dark_Nexus: 4 Dec, 2006 - 10:16 PM
User is offlineProfile CardPM
+Quote Post

janet
RE: Arrays
4 Dec, 2006 - 08:12 PM
Post #2

New D.I.C Head
*

Joined: 4 Dec, 2006
Posts: 3


My Contributions
I figured it out...just needed to get away from the computer for a second.

Here is what I did:
CODE

void getdata (int table[] [cMax_Cols])
{
     cout << "\nEnter high temperature for each month \n";
     for (int row = 0; row < 1; row++)
      for (int col = 0; col < cMax_Cols; col++)
          cin >>  table [1][col];
     cout << "\nEnter low temperature for each month \n";
     for (int row = 0; row < 1; row++)
      for (int col = 0; col < cMax_Cols; col++)
          cin >>  table [2][col];    
      return;
}


This post has been edited by Dark_Nexus: 4 Dec, 2006 - 10:16 PM
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/8/09 08:03PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month