Hey guys,
As of 74 minutes ago I started learning C++. I woke up this morning, made a coffee, and since then I've written two programs. One that says "I'm a C++ Programmer" and the other adds 8 and 5 together. I had no intention of learning C++ but now I've started I can't stop.
Anyway I have a question - and being the newbie I am I'm sure it won't strain your brains I am just learning about "cout" and "endl" and have been told to write a very simple script that puts some things on the sreen. However, I am faced with two errors when I try and compile it which I cannot work out! (I am using Microsoft Visual C++ to compile it - Ill just post the 2 lines that are causing my grief.
1. cout << "Here's a fraction:t\" << (float) 5/8 << endl;
The error for this line is -
C:\hello\leet.cpp(11) : error C2001: newline in constant
2. cout << "And a VERY big number:\t\t" << (double) 7000 * 7000 << endl;
And the error for this line is -
C:\hello\leet.cpp(12) : error C2146: syntax error : missing ';' before identifier 'cout'
I just want to know why they are errors and what should be done to fix them - I want to _understand_ why they are errors.
Anyway I'm sure you are all busy and probably find a question like this "boring" and I could understand if you tell me to go work it out for myself! But I thought I'd ask anyway
Thanks heaps
Quanta
As of 74 minutes ago I started learning C++. I woke up this morning, made a coffee, and since then I've written two programs. One that says "I'm a C++ Programmer" and the other adds 8 and 5 together. I had no intention of learning C++ but now I've started I can't stop.
Anyway I have a question - and being the newbie I am I'm sure it won't strain your brains I am just learning about "cout" and "endl" and have been told to write a very simple script that puts some things on the sreen. However, I am faced with two errors when I try and compile it which I cannot work out! (I am using Microsoft Visual C++ to compile it - Ill just post the 2 lines that are causing my grief.
1. cout << "Here's a fraction:t\" << (float) 5/8 << endl;
The error for this line is -
C:\hello\leet.cpp(11) : error C2001: newline in constant
2. cout << "And a VERY big number:\t\t" << (double) 7000 * 7000 << endl;
And the error for this line is -
C:\hello\leet.cpp(12) : error C2146: syntax error : missing ';' before identifier 'cout'
I just want to know why they are errors and what should be done to fix them - I want to _understand_ why they are errors.
Anyway I'm sure you are all busy and probably find a question like this "boring" and I could understand if you tell me to go work it out for myself! But I thought I'd ask anyway
Thanks heaps
Quanta