Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Ragged Array and Pointers.

$
0
0
1. Prompt for user ID, station, and lab.
2. Fixed array[SIZE]; SIZE = 4.
3. Each array points to dynamic array

So do i have the user determine the array size with the pointer? I'm so confused how to do a ragged array. I get
that its a multidimensional array with multiple inputs and outputs. But how do I go about prompting the user for it
and printing out each possible outcome? Like user says station 1, lab 2, and their custom id number. I hate being
confused.

#include <iostream>

using namespace std;

int main ()
{
  int *lab1, *id, *station;
  cout << "What station are you going to be on? ";
  lab1 = int[i];
  cin >> i;
  if (lab1[0] == 0)
  {
      cout << "Error";
  }
  else
  {
	for (lab=0; n<i; n++)
	{
	  cout << "Enter ID number: ";
	  cin >> lab[n];
	}
	cout << "You have entered: ";
	for (lab=0; n<i; n++)
	  cout << lab[n] << ", ";
	delete[] p;
  }
  return 0;
}


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>