Thread: coding with dev-cpp

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    56

    Question coding with dev-cpp

    i am learning c++ and using dev-c++
    so this is c++
    here is the code i use look below the code for the problem

    code=

    #include <windows.h>
    #include <iostream.h>
    #include <stdio.h>
    #include <stdlib.h>

    int main()
    {
    cout << "Hello World!" << endl;

    cout << "Press ENTER to continue...";

    cout << "enter your name:";
    cin.getline (name, sizeof (name));
    cout <<"\ngreetings, "<< name << "\n";

    cout << "npress enter to continue...">
    }


    message from compiler =

    c:\windows\desktop\to u.cpp: In function `int main()':
    c:\windows\desktop\to u.cpp:13: `name' undeclared (first use this function)
    c:\windows\desktop\to u.cpp:13: (Each undeclared identifier is reported only once
    c:\windows\desktop\to u.cpp:13: for each function it appears in.)
    c:\windows\desktop\to u.cpp:17: parse error before `}'

    if you can help me help me please and if you do so thanks
    Last edited by gamer; 01-25-2003 at 01:53 AM.
    if x == y , y == x

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Ask, and ye shall recieve....you MUST declare a variable before using it!!

    Code:
    #include <windows.h>
    #include <iostream.h>
    #include <stdio.h>
    #include <stdlib.h>
    
    int main()
    {
    char name[100]; //...declaration!
    
    cout << "Hello World!" << endl;
    
    cout << "enter your name:";
    
    cin.getline (name, sizeof (name));
    
    cout <<"\ngreetings, "<< name << "\n";
    
    cout << "Press ENTER to continue...";
    
    cin.get(); //...'pause' screen...
    
    return 0; //...main returns an integer.
    }
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #3
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Posts
    953
    gamer, did you read the errors first, my advice to you is try reading them first, and try solving the problem yourself...
    none...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. strange problem with dev cpp
    By henrychan22 in forum C++ Programming
    Replies: 8
    Last Post: 06-18-2006, 11:05 AM
  2. Replies: 2
    Last Post: 04-09-2006, 07:20 PM
  3. Multiple Cpp Files
    By w4ck0z in forum C++ Programming
    Replies: 5
    Last Post: 11-14-2005, 02:41 PM
  4. Linker error in Dev Cpp (DX)
    By C+noob in forum Game Programming
    Replies: 2
    Last Post: 08-15-2005, 03:13 AM
  5. dev cpp documentation
    By sanchezero in forum Game Programming
    Replies: 2
    Last Post: 06-18-2002, 02:32 PM