Professional Documents
Culture Documents
Example
#include <iostream>
int main()
{
string characterName = "Marc";
int character Age;
character Age = 19;
cout << "There once was a man named " << characterName << endl;
cout << "He was " << characterAge << "years old" << endl;
cout << "He liked the name " << characterName << endl;
cout << "But did not like being " << characterAge << endl;
return 0;
}
Datatype
int main ()
return 0;
}
#include <iostream>
int main ()
{
string phrase = "Marc Gwapo";
0123 45678
string phrasesub;
phrasesub = phrase.substr(4, 3);
cout << phrase [1];
cout << phrase.length();
cout << phrase.find(Gwapo);
cout << phrase.substr(4, 3);
cout << phrase;
cout << "Marc\n Academy" << endl;
return 0;
}
#include <iostream>
int main ()
{
int wnum = 5;
double dnum = 5.5;
wnum+ = 80;
return 0;
}
Function
basic math function
% is remainder 2%5 is 1
squareroot = sqrt
to the power = pow
round = rounder
ceil = round up
floor = round down
fmax = greater than less than
fmin = less than greater than
#include <iostream>
#Include <cmath>
using namespace std;
int main ()
{
retunr 0;
}
int main ()
{
int age;
cout << "Enter your age: ";
cin >> age
cout << "You are " << age << " years old";
string name;
cout << "Enter your name: ";
getline (cin, name);
return 0;
}
Build a Calculator
#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
int num1, num2;
cout << "Enter first number: ";
cin >> num1;
return 0;
}
#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
return 0;
}
Arrays
#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
luckyNums[15] = 100
luckNums [18] = 125
return 0;
}
Functions
void no return statement
#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
return 0;
}
Return Statement
Functions
#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
return 0;
}
if statement
&&
|| is or
! is negation operator
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
return 0;
More if statement
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
https://www.youtube.com/watch?v=vLnPwxZdW4Y 1:47:00