Jump to content
Washington Football Team Logo
Extremeskins

Random Thought Thread


stevenaa

Recommended Posts

Was goofing around on the other forum writing C++ programs to settle math debates they're having over there. While writing this dumb improvised program which is pretty much written in the old style of C++ (nowadays they define the library differently, in my day it was #include<iostream.h>)

Anyway I remembered a big issue I had with C++ which was the difference between = and ==. I'm trying to define these integer variables with a function and I can't remember which to use.

Example

var1=var2+var3

Can't remember whether it's = or ==. I seem to recall == for variables but I'm not sure.

Link to comment
Share on other sites

Was goofing around on the other forum writing C++ programs to settle math debates they're having over there. While writing this dumb improvised program which is pretty much written in the old style of C++ (nowadays they define the library differently, in my day it was #include<iostream.h>)

Anyway I remembered a big issue I had with C++ which was the difference between = and ==. I'm trying to define these integer variables with a function and I can't remember which to use.

Example

Can't remember whether it's = or ==. I seem to recall == for variables but I'm not sure.

= is for assignment. So if I want x to equal 6, I'll use x = 6.

== is for comparison, to see if two objects are equal. So if I want to check if x equals 6, It'd be x==6. == is usually used inside loops and if statements.

Also, C++ still uses the #include for importing libraries.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...