Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include <iostream> | ||
|
||
using namespace std; | ||
|
||
/* | ||
Functions can be a value returner or can return nothing. | ||
If they return a value, they must be created specifying the value they will return. | ||
If they don't need to return anything, they do not need a data-type identifier; instead be called with `void` | ||
*/ | ||
|
||
int int_function(int x) { // requires an argument | ||
x+=1; | ||
return x; // returns int value which has been incremented by +1 | ||
} | ||
|
||
void fuckery(string fuckery_string) { | ||
cout << fuckery_string << endl; // just console outputs the fuckery string you passed | ||
return; // possible to have a return, but cannot return a value | ||
} | ||
|
||
int main() { | ||
// this is a function, the main function | ||
cout << int_function(10) << endl; // this console outputs 11 as it is 10+1, run it to find out | ||
fuckery("fuck"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <iostream> | ||
|
||
using namespace std; | ||
|
||
#define NAME "Taran" // defines a data value without using the string NAME = "aaa"; stuff | ||
#define print_taran | ||
|
||
int main() { | ||
cout << NAME << endl; | ||
#ifdef print_taran | ||
cout << "Taran"; // will only print Taran if the value in the ifdef is defined previously | ||
#endif | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <iostream> | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
char this_is_a_char = 'a'; | ||
std::string this_is_a_string = "this is a string"; // as we are using namespace std; don't need to use std:: | ||
int this_is_an_int = 10; | ||
bool this_is_false = false; | ||
double this_is_a_double = 1.24; | ||
float this_is_a_float = 1.34; | ||
|
||
// You can console output these with the following: | ||
// I will not do it for all as that's aids. | ||
|
||
cout << this_is_a_char << endl; | ||
|
||
return 0; | ||
} |