i am getting a lot of errors

hi , i am trying to learn c++ and i just copied and paste a sample but i am getting errors
1
2
3
4
5
13 C:\Users\habour0\Documents\Untitled2.cpp `cout' undeclared (first use this function) 
13 C:\Users\habour0\Documents\Untitled2.cpp expected `;' before "pointer" 
15 C:\Users\habour0\Documents\Untitled2.cpp `y' undeclared (first use this function) 
23 C:\Users\habour0\Documents\Untitled2.cpp expected `;' before "sinif"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
#include ‹iostream›
using namespace std;
 
class myclass{
        int x;
        public:
        int y;
        void changex(int num){x= num ;}
        int getx(){return x;}
} ;
 
void fonksiyon (myclass *pointer){
        cout ‹‹ pointer-›y ‹‹ "\n";
        cout ‹‹ pointer-›getx() ‹‹ "\n";
        pointer-›y = 8 ;
}
 
int main(){
        myclass sinif;
        sinif.y = 5;
        sinif.changex(2);
        fonksiyon (&sinif);
        cout ‹‹ sinif.y ‹‹ "\n";
}
You have copied bad characters from the internet and pasted them into your code. Characters that you can't even see. This is what happens when people put code on the web without being careful with the formatting.

Type the program in again, by hand, and all the bad characters will be gone.






There is a little mistake i guess...
What are these symbols: ‹›? It's not the same of these: <>.
Try changing those symbols, they are in the #include line and in the cout lines.
But the errors mean all other things... Just try it.
Topic archived. No new replies allowed.