using a windows textbook on a mac...

Hi hi hi, just starting out with my ambitiously titled "Learn C++ in 21 days" by Sams, my computer is a mac osx.

The book is basically designed for a windows platform, but apparently should work on a mac with a little tweaking. I'm using xCoder, and have managed to get everyones favorite first program 'hello world' to run using the 'build and run' function on the editor.

The 2nd program in the book however brings up errors and I have no idea why.

the lines that seems to be causing the problem are

std::cout << end1;
...
..
...
std::cout << end;

it brings up the error "error end1 was not declared in this scope"

any ideas about how to fixit???

here's a copy of the whole program if it helps...

#include <Carbon/Carbon.h>

#include <iostream>
int main();
int main()
{
int x = 5;
int y = 7;
std::cout << end1;
std::cout << x + y << " " << x * y;
std::cout << end;
return 0;
}

Thank you very much



closed account (z05DSL3A)
replace end1 and end with std::endl?
I'm using a mac too.and i fixed the codes for you..they work.

#include <iostream>
using namespace std;
int main();
int main()
{
int x = 5;
int y = 7;
cout << endl;
cout << x + y << " " << x * y;
cout << endl;
return 0;
}



and btw its "endl" not "end1". "endl" stands for "end-line"

Th th th thankyouverymuch!

these annoying little things are like big mountains of frustration to us new kids, and I do appreciate you wasting your time a little to solve my puny problem.

Mike
you're welcome:)
Topic archived. No new replies allowed.