Object orientation programming
Apr 6, 2015 at 3:43pm UTC
Write your question here.
1 2 3 4 5 6
Int x=20
Int y=1
If (x <0 || x>y&&y != 9)
--x
--y
Cout <<x<<"" <<y<< endl
This is in the book oop c++ but when I run this program it gives off a lot of errors I am just starting into OOP please any assistance would be helpful please
Apr 6, 2015 at 3:50pm UTC
Your title is kinda confusing since this has nothing to do with OOP :p
Either way. Its
int
not
Int
lowercase "i".
Same with the if statement. The syntax in c++ pretty much never starts with a big letter. Same with
cout
.
Also you need to have semicolons at the end of each thing.
int x=20;
Also you probably want a space in between so do it like this instead
<< " " <<
Full program:
1 2 3 4 5 6 7 8 9
int x = 20;
int y = 1;
if (x <0 || x>y&&y != 9)
{
--x;
--y;
}
cout << x << " " << y << endl;
Thanks for using codetags.
Apr 6, 2015 at 3:57pm UTC
This is how the book we are using for this class showed the code thank you for the assistance
Apr 6, 2015 at 3:59pm UTC
This is how the book we are using for this class showed the code
hmm Maybe it was pseudo code? Meaning they don't show code that you can compile, but its written in a way that is understandable yet not compilable.
Topic archived. No new replies allowed.