where can i get the c and c++ compiler.i eed to run it on a windows xp machine.
where can i get the c and c++ compiler.i eed to run it on a windows xp machine.
this sholud be in c code
#include<stdio.h>
#include<conio.h>
#include<string.h>
FILE *fp1, *fp2;
int count;
struct record
{
char name[20];
int empnum;
char depart[20];
float hours;
float rate;
};
void main()
{
struct record h;
int acount=0,adcount=0,scount=0;
float grosspay,totalg=0;
float tax,totalt=0;
float health,totalh=0;
float pension,totalp=0;
float netpay,totaln=0;
float deductions;
clrscr();
fp1=fopen("employ.dat","r");
fp2=fopen("payrol.dat","w");
count = 0;
printf(" ""Page1\n");
printf(" ""ABC COMPANY EMPLOYEE REPORT""\n");
printf("------------------------------------------\n");
printf("%5s %20s %10s %12s %5s %10s %9s %7s\n","Name","Empnumber","Depart","Tax","Health","Pension","Netpay");
printf("___________________________________________________________________________________\n");
while(fread(&h,sizeof(struct record),1,fp1)==1)
{
grosspay=h.hours*h.rate;
tax = 0.155 * grosspay;
pension=0.03*grosspay;
deductions=(tax+health+pension);
netpay=grosspay-deductions;
totalg=totalg+grosspay;
totalt=totalt+tax;
totalh=totalp+pension;
totaln=totaln+netpay;
printf("%2s\t %5d\t %10s\t %4.2f\t %4.2f\t %4.2f\t %4.2f\t %4.2f\n",h.name,h.empnum,h.depart,grosspay,tax,health,pension,netpay);
if(strcmp(h.depart,"Sales")==0
scount=scount+1;
else if(strcmp(h.depart,"Admin")==0)
adcount=adcount+1;
else
acount=acount+1;
count++;
}
printf("__________________________________________\n");
printf("TOTALS %4.2f\t %4.2\t %4.2f\t %4.2f\t %4.2f\n",totalg,totalt,totalh,totalp,totaln);
printf("Total Number From Sales Department:%d\n",scount);
printf("Total Number From Sales Department:%d\n",scount);
printf("Total Number From Admin Department:%d\n",adcount);
printf("Total Number From Accounts Department:%d\n",&acount);
printf("Total Number Of Employees:%d\n",count);
fwrite(&h,sizeof(h),1,fp2);
fclose(fp1);
fclose(fp2);
}
I"ve done all the changes but still it wont run please help
its supposed to be in c code.i dont know if that is the right way of coding.
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<iomanip.h>
FILE *fp1, *fp2;
int count;
struct record
{
char name[20];
int empnum;
char depart[20];
float hours;
float rate;
};
void main()
{
clrscr();
record h;
int acount=0,adcount=0,scount=0;
float grosspay,totalg=0;
float tax,totalt=0;
float health,totalh=0;
float pension,totalp=0;
float netpay,totaln=0;
float deductions;
fp1=fopen("employ.dat","r");
fp2=fopen("payrol.dat","w");
count = 0;
printf(" ""Page1\n");
printf(" ""ABC COMPANY EMPLOYEE REPORT""\n");
printf("------------------------------------------\n");
printf("%5s %20s %10s %12s %5s %10s %9s %7s\n","Name","Empnumber","Depart","Tax","Health","Pension","Netpay");
printf("___________________________________________________________________________________\n");
while(fread(&h,sizeof(struct record),1,fp1)==1)
{
grosspay=h.hours*h.rate;
tax = 0.155 * grosspay;
pension=0.03*grosspay;
deductions=(tax+health+pension);
netpay=grosspay-deductions;
totalg=totalg+grosspay;
totalt=totalt+tax;
totalh=totalp+pension;
totaln=totaln+netpay;
printf("%2s\t %5d\t %10s\t %4.2f\t %4.2f\t %4.2f\t %4.2f\t %4.2f\n",h.name,h.empnum,h.depart,grosspay,tax,health,pension,netpay);
if(strcmp(h.depart,"Sales")==0
scount=scount+1;
else if(strcmp(h.depart,"Admin")==0)
adcount=adcount+1;
else
acount=acount+1;
count++;
}
printf("__________________________________________\n");
printf("TOTALS %4.2f\t %4.2\t %4.2f\t %4.2f\t %4.2f\n",totalg,totalt,totalh,totalp,totaln);
printf("Total Number From Sales Department:%d\n",scount);
printf("Total Number From Sales Department:%d\n",scount);
printf("Total Number From Admin Department:%d\n",adcount);
printf("Total Number From Accounts Department:%d\n",&acount);
printf("Total Number Of Employees:%d\n",count);
fwrite(&h,sizeof(h),1,fp2);
fflush(stdin);
fclose(fp1);
fclose(fp2);
}
Anyone out there pliz help me.am new to c++ and the program am supposed to write has to accept
and i have to use a formula (population*growth const) to find the growth of the country.
dispalay sholud be like as below.
country_name population growth_const growth
here is what i have tried
#include<iostream.h>
#include<conio.h>
char country[20];
int grth_const[20];
int pop[20]
int i;
int growth[20]
void main()
{
clrscr();
for (i=o;i<=19;i++)
{
cout<<"Enter country name";
cin>>country[i]; //the country name is supposed to be stored into an array of countries since ther are loads to be entered
cout<<"Enter population"; //this is the population of the countries above
cin>>pop[i];
cout<<"enter growth rate";
cin>>grth_const[i];
growth[i]=pop[i]*grth_const[i];
}
for(int b=0;b<=19;b++)
{
cout<<country[i]<<pop[i]<<grth_const[i]<<growth[i];
}
}