Skip to content
Permalink
Browse files
Uploading: *.cpp
  • Loading branch information
nagrat committed Mar 10, 2023
1 parent 4b4fdb3 commit ac6ecd1bf2931b6c0b06488dae46957405d91a6c
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
@@ -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;
}
@@ -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;
}
@@ -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;
}

0 comments on commit ac6ecd1

Please sign in to comment.