Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

What's wrong with this code? (very short code)

So I'm trying to learn C++ from this book and it uses an example:

#include <iostream>
using namespace std;

int main()
{
int num = 100;
char letter = 'M';
float decimal = 7.5;
double pi = 3.14159;
bool flag = false;

cout << "num:\t" << num << end1;
cout << "letter\t" << letter << end1;
cout << "decimal:" << decimal << end1;
cout << "precise:" << pi << end1;
cout << "flag\t" << flag << end1;
return 0;
}

now when I try to compile this I get errors;

C:\Documents and Settings\Administrator\Desktop\variables.cpp In function `int main()':

Line 12 C:\Documents and Settings\Administrator\Desktop\variables.cpp `end1' undeclared (first use this function)


I am using Bloodshed Dev-C++

Can anyone help me out?

The outcome is supposed to look like this;

num: 100
letter M
decimal:7.5
precise:3.14159
flag 0
I don't know what's wrong exept: << end1;
It needs to be: << endl; <-- last = L

further i don't know...
will try this evening what's wrong
rofl oh

yeah that's the problem

this book made the L look like a 1

thanks man
It's a very common mistake when learning C++.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by imrankhanDec 28, 2013 06:22 PM 19 599 Dec 28, 2013 06:22 PM
Last Post: Сlassy
[Shell] by Quantum BatchSep 17, 2012 12:46 PM 1 273 Sep 17, 2012 12:46 PM
Last Post: Johnny Cache
[.NET] by NezamiMar 6, 2010 09:39 AM 9 86 Mar 6, 2010 09:39 AM
Last Post: Nezami