Below is my code:
#include "stdafx.h"
#include "strlib.h"
#include "simpio.h"
#include "genlib.h"
int _tmain(int argc, _TCHAR* argv[])
{
int num1,nom1,num2,nom2,num3,nom3,num4,nom4;
double nem1,nem2,nem3,nem4;
string a,b,c,d;
printf("Enter first name: ");
a=GetLine();
printf("Enter games played for %s: ",a);
num1=GetInteger();
printf("Games won for %s: ",a);
nom1=GetInteger();
nem1=(nom1/num1)*100;
printf("\n");
printf("Enter second name: ");
b=GetLine();
printf("Enter games played for %s: ",b);
num2=GetInteger();
printf("Games won for %s: ",b);
nom2=GetInteger();
nem2=(nom2/num2)*100;
printf("\n");
printf("Enter third name: ");
c=GetLine();
printf("Enter games played for %s: ",c);
num3=GetInteger();
printf("Games won for %s: ",c);
nom3=GetInteger();
nem3=(nom3/num3)*100;
printf("\n");
printf("Enter fourth name: ");
d=GetLine();
printf("Enter games played for %s: ",d);
num4=GetInteger();
printf("Games won for %s: ",d);
nom4=GetInteger();
nem4=(nom4/num4)*100;
printf("\n");
printf("Name Games Played Games Won Winning %\n");
printf("---- ------------ --------- ---------\n");
printf("%s -%d -%d -%0.f%% \n",a,num1,nom1,nem1);
printf("%s -%d -%d -%0.f%% \n",b,num2,nom2,nem2);
printf("%s -%d -%d -%0.f%% \n",c,num3,nom3,nem3);
printf("%s -%d -%d -%0.f%% \n",d,num4,nom4,nem4);
}
-------------------------------------------------------------------------------------
The Winning column does not display the numbers properly. What's my mistake?
thank you.