Hi, this is my journal and a program to make me learn back the C++ language
The lesson stopped here
Source code below:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
cout << "Working with Variables and Data Types" << endl;
char examplegrade = 'A';
string creatoruserID = "creator";
cout << "Hello "<< creatoruserID << "." << endl;
int creatorcharacterID;
creatorcharacterID = 7;
cout << "You are number " << creatorcharacterID << "." << endl;
int creatorage;
creatorage = 27;
cout << "You are " << creatorage << " years old in the year 2022." << endl;
double sevenpointseven = 7.7;
cout << "7 + 0.7 = " << sevenpointseven << endl;
cout << " " << endl;
cout << "Working with Strings" << endl;
string phrase = "SECONDLETTERE";
cout << phrase << endl;
cout << "what is the last letter of this word?" << endl;
cout << phrase[1] << endl;
cout << "Replace the last letter to F" << endl;
phrase[12] = 'F';
cout << phrase << endl;
cout << "There are " << phrase.length() << " letters in this word" << endl;
cout << "Start this phrase from the letter L" << endl;
cout << phrase.substr(6, 7) << endl;
cout << "Remove the last character" << endl;
cout << phrase.substr(6, 6) << endl;
cout << " " << endl;
cout << "Working with numbers" << endl;
cout << 40;
cout << -20;
cout << " equals " << 40 - 20 << endl;
cout << "multiply 3 and 2" << endl;
cout << 3*2 << endl;
cout << "10+20*6 equals ";
cout << 10+20*6 << endl;
cout << "(10+20)*6 equals ";
cout << (10+20)*6 << endl;
cout << "2 to the power of 6 is " << pow(2, 6) << endl;
cout << "Square root of 81 is " << sqrt(81) << endl;
cout << "round 6.7 = " << round(6.7) << endl;
cout << "round 8.3 = " << round(8.3) << endl;
cout << "Choose the bigger number : " << fmax(round(8.3),round(6.7)) << endl;
cout << "Choose the smaller number : " << fmax(round(8.3),round(6.7)) << endl;
cout << " " << endl;
cout << "Getting user input" << endl;
string name;
int age;
cout << "Please enter your name" << endl;
getline(cin, name);
cout << "Hello " << name << endl;
cout << "How old are you?" << endl;
cin >> age;
cout << "You are " << age << " years old" << endl;
cout << " " << endl;
cout << "Lets build a calculator!" << endl;
int num1, num2;
cout << "Enter first number: ";
cin >> num1;
cout << "Enter number to add: ";
cin >> num2;
cout << "the number you have obtained is: " << num1 + num2;
cout << " " << endl;
cout << "Let's get you programming the next few words!" << endl;
string favName, colour, pluralNoun, blank;
cout << "";
getline(cin, blank);
cout << "enter a favName: ";
getline(cin, favName);
cout << "enter a colour: ";
getline(cin, colour);
cout << "enter a plural Noun: ";
getline(cin, pluralNoun);
cout << " " << endl;
cout << "Roses are " << colour << endl;
cout << pluralNoun << " are blue" << endl;
cout << "I love "<< favName << endl;
return 0;
}