title: Why am I getting "error: expected expression"?
body: <p>I am writing a program to do the following:</p>
  
  <p>"print a set of real numbers in descending order (sorting). The program should also print out the median of the numbers input and how many numbers were input. The program should read in numbers until a negative number is read. The negative number serves as a sentinel or marker telling the program when to stop reading numbers. The program should then sort the numbers and print them out in order from largest to smallest. Note, the sentinel number is not to be considered as one of the numbers, it should not be printed. The program should be able to handle up to 100 input numbers. If the user attempts to enter more than 100 numbers, the program should print an error message and quit."</p>
  
  <p>I know my syntax is incorrect as I am very new to C++. Here is my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;iostream&gt;
  using namespace std;
  
  int get_numbers(float nums[])
  {
      float num;
      int i = 0;
  
      cout &lt;&lt; "Enter a real number ";
      cin &gt;&gt; num;
  
      while (num &gt;= 0)
      {
          if (i == 100)
          {
              cout &lt;&lt; "Error: too many numbers read. Good bye";
              break;
          }
  
          nums[i] = num; 
          i += 1;
  
          cout &lt;&lt; "Enter a real number: ";
          cin &gt;&gt; num;
      }
      return i;
  }
  
  int sort_numbers(float nums[], int num)
  {
      int swapped, j, i, temp;
  
      swapped = true;
      for(i = 1; i &lt; num; i++)
      {
          if (swapped != true)
          {
              break;
          }
          swapped = false;
  
          for(j = 1; i &lt; (num-i); i++)
          {
              if (nums[j] &lt; nums[j+1])
              {
                  temp = nums[j];
                  nums[j] = nums[j+1];
                  nums[j+1] = temp;
                  swapped = true;
              }
          }
      }
      return 0;
  }
  
  int print_numbers(float nums[], int num)
  {
      int i, median;
  
      cout &lt;&lt; "The numbers in descending order are: ";
      for(i = 1; i &lt; num; i++)
      {
          cout &lt;&lt; (nums[i]);
      }
  
      if (num % 2 == 0)
      {
          median = (nums[num/2-1] + nums[num/2]) / 2;
      }
      else
      {
          median = (nums[num/2]);
      }
  
      cout &lt;&lt; "The median number is " &lt;&lt; median;
  
      return 0;
  }
  
  int main()
  {
      int num_numbers = 0;
      float a[] =[0.0] * 100;
  
      num_numbers = get_numbers(a);
      sort_numbers(a, num_numbers);
      print_numbers(a, num_numbers);
  
      return 0;
  }
  </code></pre>
  
  <p>I keep getting an error that states "error: expected expression" on line 85 at the bottom for the line
  <code>float a[] =[0.0] * 100;</code></p>
  
  <p>I don't know the syntax well enough to even know what to try to fix. Can you help me get my program running?</p>
  
  <p>EDIT:
  I am translating a Python program to C++. Here is the python program:</p>
  
  <pre><code>    i = 0
  
      num = float(input("Enter a real number: "))
  
      while num &gt;= 0:
          if i == 100:
              print("Error: too many numbers read. Good bye")
              exit()
  
          nums[i] = num
          i += 1
  
          num = float(input("Enter a real number: "))
  
      return i
  
  def sort_numbers(nums, num):
  
      swapped = True
      for i in range(1,num):
          if swapped != True:
              break
          swapped = False
          for j in range(num-i):
              if nums[j] &lt; nums[j+1]:
                  temp = nums[j]
                  nums[j] = nums[j+1]
                  nums[j+1] = temp
                  swapped = True
  
  
  def print_numbers(nums, num):
  
      print("The numbers in descending order are:")
      for i in range(num):
          print(nums[i])
  
      if num%2 == 0:
          median = (nums[num//2 - 1] + nums[num//2]) / 2
      else:
          median = nums[num//2]
  
      print("The median number is", median)
  
  def main():
      num_numbers = 0
      a = [0.0] * 100
  
      num_numbers = get_numbers(a)
      sort_numbers(a, num_numbers)
      print_numbers(a, num_numbers)
  
  if __name__ == "__main__":
      main()
  </code></pre>