新手需要帮助我找不到什么错.我输入num并停止

0 arrays visual-c++

/*********************************************************************
 *Program Name      :   CSC 110 - 003 Store Unknown Number of Values
 *Author            :   Anthony Small
 *Due Date          :   Nov\17\09
 *Course/Section    :   CSC 110 - 003
 *Program Description:  Store Unknown Number of Values in an Array
 *
 *BEGIN Lab 7 - CSC110-003  Store Unknown Number of Values
 *  init Array to five
 *  init Count to Zero
 *  Get First Value or Quit
 *  WHILE (Value is not Quit)
 *        Store Value into Arry
 *        Add One to Count  
 *  IF    (Array is Full)
 *        Set Value to Quit
 *        Cout Full Message
 *  ELSE  Get Next Value or Quit
 *  End IF
 *  END WHILE
 *  FOR   (Set Value in the Array)
 *        Display Value
 *  END FOR
 *End Lab 7 - Store Unknown Number of Values
 *********************************************************************/

#include <iostream>
#include <iomanip>
//#include <stdlib>
#include <ctime> //or <ctime>

using namespace std;

int main()
{
//local constants
const int Quit = -1;                            //Sentinal value                            
const int SIZE = 5;                             //Max number of inputs
//local variables
int Num ;
int Count=0;
int Array [SIZE];

//******************************************************************/
// Display Input
cout << "Input first Number or Quit\n";  
cin >> Num;
while   (Num != Quit);

        Array [0] = Num;                        //Store number into array
        Count++;                                //Add one to count
    if (Count==SIZE-1)              
    {
        (Num = Quit);
        cout <<"Array is full";
    }
    else cout <<"Enter next number or quit\n";
      cin>>Num;                                 //Input next number

for (int pos = 0;pos < SIZE; pos++)
    cout << Array [pos];            
return 0;
//end main program
}
Run Code Online (Sandbox Code Playgroud)

Tra*_*v L 7

当你这样做

while   (Num != Quit);
Run Code Online (Sandbox Code Playgroud)

你的意思是:

while (Num != Quit)
{
  // Code here...
}
Run Code Online (Sandbox Code Playgroud)