473,386 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Declaration Syntax Error

#include <iostream.h>
int main()
{
cout<<"Welcome to C++";
}

This program is not working
Sep 2 '08 #1
3 952
JosAH
11,448 Expert 8TB
Oh dear.

kindest regards,

Jos
Sep 2 '08 #2
weaknessforcats
9,208 Expert Mod 8TB
Please explain what you mean by not working. Are you getting an error? If so, what is the error?
Sep 2 '08 #3
Ganon11
3,652 Expert 2GB
1) You are using iostream.h, which is now deprecated. Leave off the .h

2) You don't output either a '\n' character or the std::endl character. cout sometimes does not print until one of these two is printed (Stick with std::endl)

3) You refer to cout as cout, not std::cout. Either write std::cout or say using std::cout at the beginning of your program, under the #include statement.

4) You are not returning 0, but you have told the compiler that main returns an int by saying "int main()". Add "return 0;" after your cout statement.

These 4 problems are very basic issues. If you copied and pasted this code from a website, don't go there again. If you copied it from a textbook, get a new textbook. If you wrote it yourself from what you learned in class, go over your notes and fix these mistakes.
Sep 2 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

83
by: Alexander Zatvornitskiy | last post by:
Hello All! I'am novice in python, and I find one very bad thing (from my point of view) in language. There is no keyword or syntax to declare variable, like 'var' in Pascal, or special syntax in...
16
by: Bhushit Joshipura | last post by:
This post contains one question and one proposal. A. May I know why order of evaluation of arguments is not specified in C/C++? I asked a question in comp.lang.c++ for the following...
3
by: Michael Sgier | last post by:
Hello with the original code below I get the error: "forward declaration of `struct CPlayer'" class CPlayer; // what does this do? Instantiate the class CPlayer? // what's a forward...
7
by: Jacob Schmidt | last post by:
Could anyone correct the error in my logic here?: #include <stdio.h> #include <stdlib.h> main () { const char message1 = {"\nCurved portion of graph -- D.G.A.C.\ \n A B C"}; const char...
2
by: Nils Emil P. Larsen | last post by:
Hello I have read about a C shared library which I want to use in my C program. (It's a library to encode/decode packets from/to a serial bus running with the SNAP-protocol). Unfortunatly...
3
by: Wild Wind | last post by:
Hello, I made a post relating to this issue a while back, but I haven't received any answer, so here I am again. I am writing a mixed C++ dll which uses the following declaration: typedef...
4
by: Alan Foxmore | last post by:
Hi everyone, I'm new to C# and I was hoping I could get some clarification on the syntax for jagged and multidimensional arrays. Here is my question: The following syntax is correct for...
2
by: srikar | last post by:
Hi I am having a problem using typedef what does these declaration mean? typedef gtb(string_t, tt_type_enum) tt_type_table( &stringless, &stringequals ); typedef gtb(string_t,tt_qual_enum)...
10
by: fred.zakity | last post by:
Can someone please explain this function pointer declaration: float (* getptr (char opcode) ) (int, int); I'm confused by the syntax - I have not seen a function pointer with the extra...
11
by: mdh | last post by:
I decided to make a single file containing all the repetitive functions in K&R so that I could concentrate on the new discussions. This went along just fine, and with each new function, added the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.