In C++ "//" is always used to introduce a comment. So I think it more than likely that you're looking at a piece of code which has been "commented out".
When might you see this? Well, some programmers often include cout statements to provide checks when developing code. For example;
1 2 3 4 5 6 7 8 9
// don't worry about what this code does (it hasn't been error checked!)
// just worry about the principle behind comments and the use of "//"
for (int i=0; i < ARRAYSIZE; i++) {
array1 [i] = rand()%6 + 1; // fill array with random elements
cout << "\n" << array1[i]; // print array elements
}
In this example the cout statement merely serves to let the programmer see what's going on inside the program. When the cout statement is no longer needed, it can be deleted or "commented out" as follows;
1 2 3 4 5 6 7 8 9
// now "cout" has been "commented out" and the system will ignore
// the entire line following "//"
for (int i=0; i<10; i++) {
array1 [i] = rand()%6 + 1; // fill array with random elements
//cout << "\n" << array1[i]; // print array elements
}
Don't be confused by the fact that there are now TWO sets of "//" in the line containing the cout command. The compiler just ignores the second set and treats the entire line like a comment.
Does that help any?
PS: a debugger is a better way to see what's going on inside your programs. If you have access to one, you should learn to use it.
Thanks your reply.
I was wondering as below coding.
int main(){
int integer;
integer = 0;
cout << "Enter your integer";
cin >> integer;
//cout >> "0";
if ( integer==0 )
{
cout<<"integer is zero."<<endl;
}
Again, thanks your explanatioin, I love your comments.
If you do, Please let me know, or anyone Please leave your comments.
I wish if I could be a better learner.
Thanks your comments.
I talked last night with my friends about it.
I could figure out how "//" means, it just use leaving comments, even if we want to write for the line code, right?
I need to do next assignment until tommrrow morning!
ha ha.