/ sub.c Copyright 2009 vishnuprathish This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. / #include int main(int argc, char** argv) { FILE *fp; fp=fopen("sub.c","r"); char ch; ch=getc(fp); while(ch!=EOF) { if(ch=='/') { ch=getc(fp); if(ch=='/') { while((ch=getc(fp))!='\n') { getc(fp);//This commment wil be removed } } if(ch=='*')/*This also wil be removed*/ { while(1) { ch=getc(fp); if(ch=='*') { ch=getc(fp); if(ch='/') { break; } } } } } printf("%c",ch); ch=getc(fp); } return 0; }
the main() function,the#include Directive, the variable definition. function prototype, program statements, the function definition,program comments and braces are the components of program in C++
/* my second program in C++ with more comments */ #include <iostream> using namespace std; int main () { cout << "Hello World! "; // prints Hello World! cout << "I'm a C++ program"; // prints I'm a C++ program return 0; }
COMMENT:- comment a re not necessary in the program. however, to understand the flow of programs the programmer can include comments in the program. comment are to be inserted by the programmer. It is useful for documentation.Comment are nothing but some kind of statements which are placed between the delimiters /* & */. The compiler does not execute comments. Thus, we can say that comments are not the part of executable program.The user can frequently use any number of comments that can be placed any where in the program. Please note that the comments and statements can be nested. The user should select the OPTION MENU of the editor and select the COMPILER - SOURCE -NESTED COMMENTS ON/OFF). The Comments can be inserted with a single statement or in nested statement.Types of comment in c/c++. is following bellow1. // this is a single line comment2. /* */ this sing is multi line OR nested line commentseg. /* int i=90;char ch=65; */ close multi line commentsmade by [ARUN KUMAR RAI]
if single line comment just place // before for single line comment else if multiple line denote as like this /*............................. ..............................*/ Strictly speaking, // is non.standard in C only in C++
The main advantage of the newer C++ comment syntax is that you only need to start the comment, and you can expect that it will last only until the end-of-line. With the older syntax, you needed to also stop the comment. any statement; /* old comment syntax */ any statement; // new comment syntax
There are no comments in C programs. Comments only exist in the source code and the precompiler automatically strips them out before the compiler sees them.
C++ also supports C program's multiple command line /* your command */.
the main() function,the#include Directive, the variable definition. function prototype, program statements, the function definition,program comments and braces are the components of program in C++
/* my second program in C++ with more comments */ #include <iostream> using namespace std; int main () { cout << "Hello World! "; // prints Hello World! cout << "I'm a C++ program"; // prints I'm a C++ program return 0; }
Please visit http://talentsealed.blogspot.com/2009/10/to-display-triangle-using-c-programming.html for the answer. Please let me know your comments
don't bother. it does not infect your computer as whole only the user a/c. create a new user a/c re-install all your info in new a/c then delete infected a/c.
The comments are there to (a) aid in debugging the program, (b) help the programmer layout the program in logical steps and (c) show anyone else looking at the code to see what each section of the code actually does.
COMMENT:- comment a re not necessary in the program. however, to understand the flow of programs the programmer can include comments in the program. comment are to be inserted by the programmer. It is useful for documentation.Comment are nothing but some kind of statements which are placed between the delimiters /* & */. The compiler does not execute comments. Thus, we can say that comments are not the part of executable program.The user can frequently use any number of comments that can be placed any where in the program. Please note that the comments and statements can be nested. The user should select the OPTION MENU of the editor and select the COMPILER - SOURCE -NESTED COMMENTS ON/OFF). The Comments can be inserted with a single statement or in nested statement.Types of comment in c/c++. is following bellow1. // this is a single line comment2. /* */ this sing is multi line OR nested line commentseg. /* int i=90;char ch=65; */ close multi line commentsmade by [ARUN KUMAR RAI]
Comments are to help other programmers (or yourself in the future) to understand what is going on in a program, especially when the code itself is complicated and may not be obvious. More time is spent maintaining and improving programs than original development, so leaving clear comments is very important!
It ignores the comments, those are for the human reader.
Most of C/C++ will support two types of comments:* // Comment text goes here (aka inline)* /* Comment goes here */ (aka block)But the first comment type is not in ANSI C standard, you will get an error message.In order to compile your program with ASNI C standard using GCC, I suggest this:gcc -Wall -ansi -pedantic -oRemoving "-ansi" would allow usage of the first type comments in C language.
if single line comment just place // before for single line comment else if multiple line denote as like this /*............................. ..............................*/ Strictly speaking, // is non.standard in C only in C++