Skip to content

Commit a11ab6c

Browse files
authored
Add files via upload
1 parent cd2977b commit a11ab6c

File tree

7 files changed

+128
-0
lines changed

7 files changed

+128
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include <iostream>
2+
3+
int main()
4+
{
5+
string personsname = "John"; // we first define a string. in this case "personname". if we change the name "John" to something else the printed text from below will change too
6+
int age; // here we create an integer
7+
age = 5; // we now set the integer value in this case "age" to 5. the same happens as for changing the name. the printed text from below changes.
8+
std::cout << "Hello My Name is " << personsname << endl;
9+
std:cout << "I am " << age << " Years Old" << endl;
10+
11+
personsname = "Brayden";
12+
std::cout << "He Liked A Paster Named " << personsname << endl; // see how i used "personsname" again, its cool isnt it?
13+
14+
return 0;
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <iostream>
2+
3+
int main()
4+
{
5+
char grade = 'A'; // used to declare character type variables
6+
string academy = "Brayden's Academy";
7+
int age = "25"; // used to display full numbers without decimals
8+
double gpa = "3.3"; // used to display numbers with decimals, you could use "float gpa = "3.3";" here too
9+
bool isGay = false; // bool can only take two values: 0 = false and 1 = true
10+
11+
std::cout << grade << endl; // you could just do "std::cout << "A" << endl;" but its easier to store your datas in variables
12+
return 0;
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <iostream>
2+
3+
int main()
4+
{
5+
string phrase = "Blih Blih"
6+
std::cout << "Blah Blah\n" << endl; // \n = new line character, basically used for strings not to print in one line. it makes the next string print in new line
7+
8+
std::cout << phrase.length(); // shows how much characters are in the strings "phrase"
9+
10+
std::cout << phrase.[0]; // the number in the brackets means the character you wanna print. 0 is equal to 1, 1 is equal to 2, 2 is equal to 3 etc.
11+
12+
std::count << phrase.find("Blih", 0); // the output will give us the index position inside the string in which Blih occurs
13+
14+
std::count << phrase.substr(2, 3); // allows to grab the set ammount of characters from index position. it will grab "ih " in this case
15+
16+
phrase[0] = 'H'; // replaces the first letter of "phrase" to H. it now will print "Hlih Blih"
17+
std::cout << phrase;
18+
19+
return 0;
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <iostream>
2+
#include <cmath> // for math functions
3+
4+
int main()
5+
{
6+
std::cout << 5 + 7; // this wont print "5 + 7" but it will actually calculate and give you the results
7+
8+
std::cout << 10 % 3; // gives us the remainder of the division
9+
10+
std::cout << 10 + 7 * 10; // the result is "80" if you got it wrong start to learn in school not github
11+
12+
std::cout << (10 + 7) * 10; // the result is "170" if you got it wrong start to learn in school not github
13+
14+
std::cout << 5 + 9.9; // yes the result is "14.9" ur getting better at maths
15+
16+
std::cout << 10 / 3; // haha got you! it will print "3" not "3.3333"
17+
18+
std::cout << 10.0 / 3.0; // we added decimals so now it will print "3.3333" instead of "3"
19+
20+
std::cout pow(2, 5); // it will raise 2 to power 5
21+
22+
std::cout round(4.6); // the result is "5"
23+
24+
return 0;
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <iostream>
2+
#include <cmath>
3+
4+
int main()
5+
{
6+
int age;
7+
std::cout << "Input Your Age: ";
8+
std::cin >> age; // this stores the users age
9+
10+
std::cout << "You Are: " << age << "Years Old"; // prints users age
11+
12+
string name;
13+
std::cout << "Input Your Name: ";
14+
getline(cin, name);
15+
16+
std::cout << "You're Name Is: " << name; // prints users name
17+
18+
return 0;
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <iostream>
2+
#include <cmath>
3+
4+
int main()
5+
{
6+
double num1, num2;
7+
std::cout << "Enter First Number: "
8+
std::cin >> num1; // getting users input for the first number
9+
10+
std::cout << "Enter The Second Number: "
11+
std::cin >> num2; // getting users input for the second number
12+
13+
std::cout << "Your Numbers Added Are Equal To: " << num1 + num2; // adding both of numbers and displaying them
14+
15+
return 0;
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <iostream>
2+
#include <cmath>
3+
4+
int main()
5+
{
6+
string color, plurar, person
7+
std::cout << "Enter A Color: "
8+
getline(cin, color);
9+
10+
std::cout << "Enter A Plural Noun: "
11+
getline(cin, plural);
12+
13+
std::cout << "Enter The Name Of The Person You Love: "
14+
getline(cin, person);
15+
16+
std:cout << "Roses are " << color << endl;
17+
std:cout << plurar <<< "are blue" << endl;
18+
std:cout << "I Love" << person << endl;
19+
return 0;
20+
}

0 commit comments

Comments
 (0)