I need to round the answer 23.428 and get 23.4.
I did a little search about it and I may need to include a line float round (s) but I did it and CODEBLOCKS gives me an error.
Note: the file Information.txt contains numbers 7.5 305.5 4.09 4
My code is:
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
int main()
{
float m, k, kk;
int n;
float s;
ifstream fd("Information.txt");
fd >> k >> m >> kk >> n;
k = k / 100;
m = m * k;
kk = kk * m;
s = kk / n;
/*s=((((k/100)*m)*kk)/n);*/
fd.close();
ofstream fr ("Rezults.txt");
fr << s;
fr.close();
return 0;
}