Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
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
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
- ?Lv 41 decade agoFavorite 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 - TrollLv 41 decade 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 - Anonymous1 decade ago
I am also using Dev C++
#include<iostream.h>
#include<conio>
main()
{
cout<<"Hello, I am your computer talking."<<endl;
getch();
}