-4

Please help I'm beginner level student in C++ I'm failed to find a proper solution.I also added error image in this question.Please give me answer with proper solution.

#include <iostream>
#include <conio.h>

class test
{
    int no;
    static int count;
    public:
        void getval (int);
        void dispcount (void);

};

void test:: getval(int x)
{
    no = x;
    cout << "Number = " << no << endl;;
    count++;
}

void test::dispcount(void)
{
    cout << "Counten = " << count;
}
    int test::count;

int main()
{
    test t1,t2,t3;

    t1.dispcount();
    t2.dispcount();
    t3.dispcount();

    t1.getval(100);
    t2.getval(200);
    t3.getval(300);

    t1.dispcount();
    t2.dispcount();
    t3.dispcount();
    getch();
    return 0;
}

here is error.jpg

Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335
Kamal Mrock
  • 374
  • 1
  • 2
  • 13

1 Answers1

1

Include directive

#include <iostream>
#include <conio.h>

using namespace std;
//..

Or include using declarations like

#include <iostream>
#include <conio.h>

using std::cout;
using std::endl;
//...

Or use qualified names as for example

void test:: getval(int x)
{
    no = x;
    std::cout << "Number = " << no << std::endl;
    ^^^^^^^^^                         ^^^^^^^^^^
    count++;
}

Identifiers cout and endl are declared in namespace std and not in the global namespace.

Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335