help with namespace

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Anjola
    New Member
    • Sep 2006
    • 11

    help with namespace

    I have the code and used namespace, but when I run the program it gives me the error. Any help how to fix it.
  • tyreld
    New Member
    • Sep 2006
    • 144

    #2
    It would be helpful if you supplied your code, and the error you are getting.

    Are you qualifying anything in the namespace with the namespace name when trying to reference it?

    "namespace_name ::function_or_v ariable"

    Comment

    • Anjola
      New Member
      • Sep 2006
      • 11

      #3
      The error is namespace name expected



      # include <iostream.h>
      # include "ListA.h"
      # include <conio.h>
      using namespace std;

      void main()
      {
      List lst;
      for (int i=0; i<30; i++)
      {
      int num;
      cout << "Enter a number: ";
      cin >> num;
      lst.add(num);

      }

      lst.print();
      int sum = lst.calculateSu m();

      cout << "The sum of the List is: "<< sum << endl;
      }
      getch();

      Comment

      Working...