Shuttleu
2009-05-29 00:45:33
I have just learnt classes in C++ and whenever i compile and run the following code i get this :confused:
where have i gone wrong :confused:
~shut
thomas@Thomas-laptop:~$ cd Documents/C++
thomas@Thomas-laptop:~/Documents/C++$ g++ first.cpp
thomas@Thomas-laptop:~/Documents/C++$ ./a.out
x = -1081553448 y = 134514585
thomas@Thomas-laptop:~/Documents/C++$
#include <iostream>
using namespace std;
class TPoint
{
public: int x, y;
};
int main()
{
TPoint tp;
cout << "x = " << tp.x << " y = " << tp.y << '\n';
return 0;
}where have i gone wrong :confused:
~shut