The "if" Function in C++:
This tutorial will allow you to easily master the IF function built into C++. It allows you to perform multiple calculations depending on the circumstances. It's a short program and only takes a few minutes. Be sure to check out my other Easy Programming videos for more beginner C++ Practice. I will post more complex tutorials as time goes by. I hope you enjoy it!
#include <iostream>
using namespace std;
void main()
{
int shirts;
float dollar;
cout << "Please enter number of shirts: ";
cin >> shirts;
if(shirts <= 5) dollar = shirts * 10;
else dollar = shirts * 8;
cout << shirts << " will cost you $" << dollar << '.' << endl;
system("pause");
}