help with C++ syntax?

i bought C++ all in one desktop reference for dummies off ebay this is the first project and it wont work!!!

#include <iostream>

#inclued <stdlib.h>

int main(int argc, char *argv[])

(

cout << "Hello, I am your computer talking." << endl;

system("PAUSE");

return 0;

)

I'm using Dev-C++ when i compile it I get this

[warning] In function 'int main(int, char**)':

'cout' undeclared (first use this function)

(Each undeclared identifier is reported oly once for each function

'endl' undeclared (first use this function)

[build error]main.0] error 1

Update:

I added using namespace std; now i get this

[warning]in function 'int main(int,char**)':

no match for 'std::basic_ostream<char, std::char_traits<char> >&>>

[build error] [main.o} error 1

you can pm me through my user profile page

3 Answers

Relevance
  • es
    Lv 4
    10 years ago
    Favourite answer

    Hello,

    Thanks for posting good, clear, complete information about your source and your errors!

    I have dev-cpp too. Here is what you need to make it run:

    1) typo; #inclued <stdlib.h> should be #include <stdlib.h>

    2) after your includes, add this (in every C++ program):

    using namespace std;

    3) The main program should be delimited by a left and right curly brace, { and }, rather than parentheses

    Here is your program after these corrections.This will work:

    #include <iostream>

    #include <stdlib.h>

    using namespace std;

    int main(int argc, char *argv[]) {

      cout << "Hello, I am your computer talking." << endl;

      system("PAUSE");

      return 0;

    }

    Source(s): Ran it
  • Troll
    Lv 4
    10 years ago

    I don't use Dev-C++ so I don't know if I can help but did you try

    #include<iostream>

    using namespace std; //for cout and cin

    int main()

    {cout<<"Hello, I am your computer talking."<<endl;

    return 0;

    }

    This works in MS Visual C++, but I am still learning C++ :)

    Source(s): Experience
  • Anonymous
    10 years ago

    I am also using Dev C++

    #include<iostream.h>

    #include<conio>

    main()

    {

    cout<<"Hello, I am your computer talking."<<endl;

    getch();

    }

Still have questions? Get answers by asking now.