0

I think I have most most of this correct at this point. Getting a couple errors when compiling via G++ . Just trying to finish this up..

#include <iostream>

using namespace std;
int main()
{

int array_size = 0;
int number; 
int* list = new int[array_size];

cout << "enter a positive number, when finished enter a negative number" << endl;
cin >> number;

while (number > 0)
  {
  list[array_size-1] = number;
  int *temp = new int[array_size=1];
  copy (list,list+array_size,temp);
  delete list;
  list = temp;
  array_size++;
  
  if (number[count] > 0);
    {
    for(int i=0;i<array_size; i++)
    temp[i] = list[i];
    delete[] list;
    list = temp;
    }
  else
    }     
 for (cout =0; count < array_size; count++)
    {
    cout << number[count] << endl;
    }

  }
return 0;
}
2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by vmanes
0

If you're expecting someone to fix your typos and simple mistakes, you may be waiting for a while.

Read the error messages, pay attention to the lines they point you to.

A couple? Well, at first maybe. Fix the errors, find your other errors, then find some more.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.