what is the difference between C and C++ regarding main() function?
440282
in c main can return void but not in c++\nin c++ it alsways return an int
676636
The difference is that "inline functions" are part of the language, whereas "macro functions" are really compiler directives.\n\nAs they are compiler directives, macros are handled at or before compile time by the compiler. Inline code, on the other hand, is compiled as it is written. According to the Wikipedia article about inline functions, Bjarne Stroustrup, creator of C++, recommends that macros should not be used very much.\n\nOften times, reliance on macros is considered bad coding practice and they may be less efficient -- they are definitely less intuitive. Generally, marcos are accepted in cross platform hacks, translating certain system dependent code to what it should be on a particular system (in that case, usually a particular system, like POSIX, is coded for, and hacks are used to let the code properly compile for Windows and other non-POSIX systems).
225626
A compiler (you may know) is the program that translates your C++ code into the language of ones and zeros that the computer understands.  As such, it does not have to look spiffy.  Ugly is okay.\n\nThere are some differences among compilers as to exactly how you use them, but the general idea goes like this.  You write your C++ program in an editor and save it to disk.  You tell the compiler where to find the program and it reads it and tries to translate it into machine language.  It fails because no one can write a perfect program the first time.  It gives you a list of errors it found.  You patiently go through the list and correct the errors as best you can, then try to compile the program again.  You keep repeating editing (debugging) and compiling until the program compiles.  Then, you find out that it doesn't do what you meant for it to do.  That is because there are still errors in the program.  You find the errors, correct them, and compile again.  You keep doing this over and over, and eventually, the program works the way you want it.\n\nYour first programs should be very, very, very simple.  I hope your book guides you in this direction.  The first program should do something like print "hello."  Once you get to that point you can enhance it.  It might ask you to input something, then output that.  You keep making more and more complicated programs, and eventually, you'll be able to program interesting stuff.\n\nGood luck!!\n\n=====================\n\nI searched google for open source compilers and the two that came out on top are linked below.  Maybe you would like one of those better.
345718
int main (void)\n{\nint a,rem\ncout<<"enter the number";\n<<cin a;\nrem=a/a;\nif(rem>0)\ncout<<"its integer";\nelse\ncout<<"not a integer";\nreturn 0;\n}
575599
#include<iostream.h>\n\n  int main()\n {\n   int n = 5;\n   for(int i=1;i<=n;i++)\n   {\n    for(int j=n;j<0;j--)\n      cout << * ;\n    }\n }
37555
You may use any editor (VI, notepad, Visual Studio Express, Programmer's Editor, ...) to create source files (c/C++ files containing instructions to be compiled). \nDepending on the language of choice (C and C++ are different languages) name your file accordingly (c for the C Language, cpp, C, c++ or cxx for C++).\nThen compile, link (generally compilers do both things with a single command, you may use GCC for any platform, or Visual C++ Express from Microsoft for Windows -which is much easier to use) and run (just type the name of the program at the command line).\n\nSample. Write:\n\n#include <stdio.h>\nint Main(int argc, char* argv[])\n{\n   puts("Hello World!");\n   return 0;\n}\n\nthen save as "hello.cpp", \n\nany platform: compile with "gcc hello.cpp -ohello" and type "hello"\nWindows: if using MS Visual C++ Express, then just press F5
253284
#include <stdio.h>\n\nint main(void) {\n\nint i, j, count; //C Sucks, wait till you take java\n\nfor(i=1; i<=1000; i++){&#92;&#92;goes through all numbers 1 to 1000\n    count=0;\n    for(j=2; j<i; j++)&#92;&#92;goes through all numbers 2 to i\n    {\n     if(i%j==0)&#92;&#92;checks to see if it i is evenly div. by i\n        count++;\n    }//nested for\n    if (count ==0)\n        printf("%d&#92;n", i);\n}//for\n\nreturn 0;\n}//main\n\n\n//Hope that helps!
464755
Do a search for 'C language tutorials' works for me. However if you have a choice go on to C++ even better
817175
Isn't C really old?  What about C++?
221466
Differences b/w Java and C++?  Some of the shortcomings of C++ were solved in Java- Some differences that quickly come to my mind:\n\n1. Java is machine idependent, (ie, The code can run on any hardware platform as long as JVM for that p/f is installed)\n2. Java is a interpreted language, not a compiled language\n3. Java doesnt have pointers- Pointers were a big pain in the a** in C and C++.\n4. Java doesnt support multiple inheritance\n....  See link
160699
#include <iostream.h>\n#include <fstream.h>\n\nvoid main()\n{\n  ofstream output;\n  output.open("outpu.dat");\n\n  output << "Ouput test data";\n\n  output.close();\n}
222349
C++ is an object-oriented programming (OOP) language that is viewed by many as the best language for creating large-scale applications. C++ is a superset of the C language. A related programming language, Java, is based on C++ but optimized for the distribution of program objects in a network such as the Internet. Java is somewhat simpler and easier to learn than C++ and has characteristics that give it other advantages over C++. However, both languages require a considerable amount of study.
750753
use gcc compiler. u can run cpp programs using gcc.\nwith this, u create a file with .out extension.\nThat to execeute, type, ./ filename.out\n\nat the terminal.
262740
C++ has classes, C does not. C++ is object-oriented, but it also contains all the functionality that C does.\n\nC requires you to declare all your variables at the top of a function, C++ allows you to declare them whenever you want.
608853
Code written in C and it works in C++\n\n#include <stdio.h>\n#include <conio.h>\n\nvoid main() {\n     float f[5];\n     int   i[5];\n     int j;\n     clrscr();\n     printf("Please, enter five float numbers: &#92;n");\n     for (j=0;j<5;j++){\n scanf("%f",&f[j]);\n i[j]=(int) f[j];\n     }\n     printf("Float value&#92;n");\n     for (j=0;j<4;j++)\n printf("%2.2f&#92;n",f[j]);\n     printf("&#92;nInteger value&#92;n");\n     for (j=0;j<4;j++)\n printf("%d&#92;n",i[j]);\n\n     getch();\n}
1174010
Buy a book. Online tutorials never helped me. I bought C++ for dummies. Its not bad.
348911
#include <stdio.h>\n#include <strings.h>\n\nint\nmain(int argc, char* argv[])\n{\n  char *token, *string = argv[1];\n  int count = 0;\n\n  while ((token=strtok(string, "&#92;t ")) != 0) {\n    count++;\n    string = 0;\n  }\n    \n  printf("String has %d words&#92;n", count);\n\n  return 0;\n}\n\n\nAnd to show that it works:\n\n$ cc cw.c\n\n$ a.out "this is a simple test"\nString has 5 words