Ok, I programmed for about a week, I started with C ++. I am writing a program that is a kind of arithmetic trainer, you enter the number of equations you want, you enter your limit for the random number generator, you specify which equations you want (/ * - +), then the program uses the for loop and goes through and generates equations and their answers in var, and then the user input is checked for this var, and if they match another var, which counts the correct answers, it increases. After the last equation, the program tells the user how many of them came out of the number of equations, and dividing the number of correct answers by the number of questions, and then multiplying this value by 100 u, we get the percentage of accuracy for this arithmetic user session. The problem is that C ++ keeps returning the value friggin 0 to me, and for my life I canβt figure out why C ++ does this in the world.
full program:
#include <iostream>
The hard part:
float getAccuracy(){ float x = (rights/amount)*100; return x;
how the program returns 0%.
Does anyone know why this is so and how to get the result im after.
source share