Floats and Integer Example

/*This example will demonstrate how to assign floats and integers.
It will also use the return carraige (\n).*/

#include<iostream.h> //Header file for cin and cout
main()
{
	int num1; //Declaring integer variable
	int num3 = 4; // Declaring and assigning integer variable
	float f1, f2; // Declaring float variables

	num1 = 6 - num3 / 2 * ( 7 + 3 * num3);
	cout << "***" << num1 << "##" << num3 << '\n';
	num1 = num1 + num3;
	cout << num1 << "!!!\n";
	cout << num1 / 2 << '\n'; //Using integer division
	f1 = 7.0;
	f2 = f1 / 2; // Using float division
	cout << "###" << f2 << "**" << f1;
	return 0;
}

/*
This is the output of this program.

***-32##4
-28!!!
-9
###3.5**7
*/