> means greater than
>= means greater than or equal to
< means less than
<= means less than or equal to
== means equal to
!= means not equal to
These are basically the operators that you need. You will need &&, ||, and ! in the future but not now.
Arrays!
Arrays are used to store multiple values in a single variable, instead of declaring separate variables for each value.
To declare an array, define the variable type, specify the name of the array followed by square brackets and specify the number of elements it should store:
string trucks[4]; (delete this before you run the next line)
// this is a comment
// 4 states how many objects will be in the array.
// to store arrays, just add these brackets{} afterward.
string trucks[4] = {"Cybertruck", "Ford F-150", "Chevrolet", "GMC"}; (Truck companies don't sue me)
And of course, you can use int, char, double, float to subsitute for "string". so you can do stuff like this...
int numbers[4] = {1, 2, 3, 4};
And to "print" (cout) these things, just do,
#include <bits/stdc++.h>
using namespace std;
int main()
{
string trucks[4] = {"Cybertruck", "Ford F-150", "Chevrolet", "GMC"}; (Truck companies don't sue me)
cout << trucks[0]; // this will print out Cybertruck.
/* Note: trucks[4] states how many objects is in the brackets,
but [0] will always be the first element. [1] will be the second, etc.
*/
return 0;
}
Sorry for the delay guys!
If there are any bugs/typos, please let me know in the comments below.
Shoutout..... @DynamicSquid "rebellious people are losers."
C++ Tutorial: Day 4!
Day 4 of C++ Tutorials!
EDIT: Willing to hire people for this for 7 cycles per post. "A cycle a day keeps unemployment away!" - @CodingCactus
Devoted Follower
@SpaceFire !
Very devoted follower is him!
Day 4 is about........ ummmm......
Operators!
Every Single Operator(for beginners)
These are basically the operators that you need. You will need &&, ||, and ! in the future but not now.
Arrays!
Arrays are used to store multiple values in a single variable, instead of declaring separate variables for each value.
To declare an array, define the variable type, specify the name of the array followed by square brackets and specify the number of elements it should store:
And of course, you can use int, char, double, float to subsitute for "string".
so you can do stuff like this...
And to "print" (cout) these things, just do,
Sorry for the delay guys!
If there are any bugs/typos, please let me know in the comments below.
Shoutout..... @DynamicSquid "rebellious people are losers."
Ummmmm Day 5 is probably about arrays and loops.
i would like to report an error (i am using replit for c++)
when i tried to make an array it would only accept it when i declared by array with
exact same thing applies to cout
i do not like to see these kinds of errors in those i worship devoutly
@SpaceFire where dat semicolon
@SpaceFire sorry, forgot about the semicolon
@HahaYes lmao the semi-colon was there it still needs std::
@SpaceFire hmmmm what did you do wrong
@HahaYes what looks wrong?

@SpaceFire hmmm first use using namespace std; first
@SpaceFire also why google analytics?
@HahaYes for now you don't need to know but probably in about next 3-10 days you should be hearing about our site across replit
@SpaceFire hmmm can you invite me?
@HahaYes idk, the council will decide your fate. Luckily the council is active right now.
@SpaceFire what is this site?
@HahaYes physimx.tech however do to the fact we are changing our host the site is temporarily down but can be found here note the site is incomplete
@HahaYes the council has a question: are you joining us for your own purposes or to help push us forward (look around or become a dev?)
@HahaYes thanks for the help namespace was missing XD
@HahaYes we are a site who have collections of physics simulations. rn we don't have many soon we will make it so users can add sims
@HahaYes
using namespace std;
isn't a very good practice, because someday you may have to pull from other namespaces.@ipastrano what does this mean? (sorry i am inexperienced)
@ipastrano using namespace std; is awesome
@HahaYes are you still interested in helping with the website
@SpaceFire um kinda but not really
@HahaYes ok then let us know when/if you ever are...
@SpaceFire ok