SHARE
TWEET

main.cpp

a guest Feb 27th, 2012 19 Never
  1. #include <iostream>
  2. using namespace std;
  3. #include "list.h"
  4.  
  5. int main()
  6. {
  7.      int m_value;
  8.     // instantiate a List class (the constructor takes NO arguments)
  9.     List list;
  10.  
  11.     // NOTE:
  12.     // List list();  is incorrect, when there are no arguments don't use ()
  13.  
  14.     // insert numbers into the list
  15.  
  16.     while (cin>>m_value)
  17.     {
  18.             list.insert(m_value);
  19.         }
  20.     list.print();
  21.     list.sum();
  22.    
  23.  
  24.  
  25.    return 0;
  26. }
RAW Paste Data
Top