problems as a beginner 1

This is a discussion on problems as a beginner 1 within the C++ Programming forums, part of the General Programming Boards category; i am having alot of problems as my beginning in prgramming. Here is a copy and paste from something i ...

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    33

    problems as a beginner 1

    i am having alot of problems as my beginning in prgramming.
    Here is a copy and paste from something i tried to compile and recieved errors and it looks exactly like the one i copied from the source and tried.

    // listing 2.2 using cout

    #include <iostream.h>
    int main()
    {
    cout << "Hello there.\n";
    cout << "Here is 5: " << 5 << "\n";
    cout << "A manipulator end1 writes a new line to your screen." <<
    ¬endl;
    cout << "here is a very big number:\t" << 70000 << end1;

    cout << "here is the sum of 8 and 5:\t" << 8+5 << end1;
    cout << "here is a fraction:\t\t" (float) 5/8 << end1;
    cout << "and a very big number:\t" << (double) 7000 * 7000 <<
    ¬endl;
    cout << "don't forget to add your name Jewa:\n";
    cout << "Jewa is now a programmer:\n";
    return 0;
    }

    and here are the errors i am recieving when im trying to compile it.

    c:\documents and settings\administrator\my documents\my c++ projects\iamaprogrammer.cpp: In function `int main()':

    c:\documents and settings\administrator\my documents\my c++ projects\iamaprogrammer.cpp:9: parse error before character 0302

    c:\documents and settings\administrator\my documents\my c++ projects\iamaprogrammer.cpp:10: `end1' undeclared (first use this function)

    c:\documents and settings\administrator\my documents\my c++ projects\iamaprogrammer.cpp:10: (Each undeclared identifier is reported only once

    c:\documents and settings\administrator\my documents\my c++ projects\iamaprogrammer.cpp:10: for each function it appears in.)
    c:\documents and settings\administrator\my documents\my c++ projects\iamaprogrammer.cpp:12: parse error before `)'

    c:\documents and settings\administrator\my documents\my c++ projects\iamaprogrammer.cpp:14: parse error before character 0302

    ____

    I cant figure out what i did wrong, heh. plz help... thanks and now im going to continue reading about what i just wrote. thanks
    this is my signature. k thx

  2. #2
    Seeking motivation... endo's Avatar
    Join Date
    May 2002
    Posts
    537
    Code:
    #include <iostream.h> 
    int main() 
    { 
         cout << "Hello there.\n"; 
         cout << "Here is 5: " << 5 << "\n"; 
         cout << "A manipulator endl writes a new line to your screen." << endl; 
         cout << "here is a very big number:\t" << 70000 << endl; 
    
         cout << "here is the sum of 8 and 5:\t" << 8+5 << endl; 
         cout << "here is a fraction:\t\t" (float) 5/8 << endl; 
         cout << "and a very big number:\t" << (double) 7000 * 7000 << endl; 
         cout << "don't forget to add your name Jewa:\n"; 
         cout << "Jewa is now a programmer:\n"; 
         return 0; 
    }

    Most of the problems seem to be with the confusion with endl, abbreviation of endline. Try the code above.

    ps dont forget to use code tags next time

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    Code:
    #include <iostream.h> 
    int main() 
    { 
         cout << "Hello there.\n"; 
         cout << "Here is 5: " << 5 << "\n"; 
         cout << "A manipulator endl writes a new line to your screen." <<¬endl; 
         cout << "here is a very big number:\t" << 70000 << endl; 
    
         cout << "here is the sum of 8 and 5:\t" << 8+5 << endl; 
         cout << "here is a fraction:\t\t" (float) 5/8 << endl; 
         cout << "and a very big number:\t" << (double) 7000 * 7000 << endl; 
         cout << "don't forget to add your name Jewa:\n"; 
         cout << "Jewa is now a programmer:\n"; 
         return 0; 
    }
    your problem is that ¬ character
    "There are three kinds of people in the world...
    Those that can count and those that can't."

  4. #4
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    Code:
    cout << "here is a fraction:\t\t" (float) 5/8 << end1;
    Change it to:
    Code:
    cout << "here is a fraction:\t\t" << (float) 5/8 << end1;

  5. #5
    Registered User
    Join Date
    Jun 2002
    Posts
    33
    yes... thats one problem... i mistaken the L for 1... i have to go back and change that... thanks for the correction. By the way.... how do u create that A character? Thanks everyone.
    this is my signature. k thx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 03:59 AM
  2. Same old beginner question...
    By Sharmz in forum C Programming
    Replies: 15
    Last Post: 08-04-2008, 12:48 PM
  3. Windows programming for beginner (Absolute beginner)
    By WDT in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2004, 11:21 AM
  4. Common Problems
    By WolfPack in forum C Programming
    Replies: 4
    Last Post: 01-28-2003, 06:38 PM
  5. tile colliision detection problems
    By werdy666 in forum Game Programming
    Replies: 1
    Last Post: 10-23-2002, 10:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21