I am brand new to C++, and trying to create a simple program to calculate GPA as is done at my high school, for the sake of practice. I can't figure out how to make it yield a non-integer answer.
#include "stdafx.h"
#include <iostream>
#include <iomanip>
void main()
{
std::cout << "Enter the number of AP classes taken in high school.";
int x;
std::cin >> x;
std::cout << "Enter the number of zero hour classes taken in high school.";
int y;
std::cin >> y;
std::cout << "Enter the number of free hours taken in high school, or other classes entirely exempt from GPA calculation.";
int z;
std::cin >> z;
int a = 24 + y - z;
float b = float (x / a);
float g = float (4 + b);
std::cout << "Your cumulative weighted GPA will be:" << g << std::endl;
}