Hello,
I do not claim to be an expert on C++.
scanf(%d%d,&x,&y) means it is looking for decimal integer. So, %d%d means "here come 2 decimal integers, and they are called variables x and y" The & symbol is the address operator of the variable. C is more cryptic than C++, but I think you will like it better than FORTRAN.
I think you can write the code:
// Let's declare and initialize the values
int x = 0, y = 0;
// User interaction to gather X and Y
// Put me in a loop though for error checking
cout << "Enter coordinates for your X: ";
cin >> x >> y;
If I were you, I would put these in loops to ensure error checking... what happens if someone tried to enter in -3, 7? Your code would probably fail.
Enjoy.
Christian
Reputation Points: 121
Solved Threads: 57
Posting Virtuoso
Offline 1,629 posts
since Mar 2004