H
happytoday
I compiled that program under turbo C without any problems but with
sunstudi I found those errors:
"pnt02ma1.c", line 37: warning: implicit function declaration: system
"pnt02ma1.c", line 58: operands must have arithmetic type: op "*"
"pnt02ma1.c", line 58: assignment type mismatch:
pointer to float "=" double
"pnt02ma1.c", line 59: operands must have arithmetic type: op "/"
"pnt02ma1.c", line 60: operands have incompatible types:
pointer to float "-" double
"pnt02ma1.c", line 61: operands must have arithmetic type: op "/"
"pnt02ma1.c", line 62: operands have incompatible types:
pointer to float "-" double
"pnt02ma1.c", line 62: warning: improper pointer/integer combination:
op "="
cc: acomp failed for pnt02ma1.c
/*-----------------------pnt02ma1.c---------------------
Given those formulas
---inch = cm / 2.45
---inch =(meter * 100)/2.45
---feet = 12 inch
---yard = 3 feet
---yard = 36 inch
---inch = 1/12 feet
---inch = 1/36 yard
---yard > feet > inch
convert given meter value to (yards , feet , and inches)
1-convert meter to the smallest unit = (inches).
2-obtain yards (biggest required value).
3-obtain the remainder inches after getting yards. m=m%36
4-obtain feet (second biggest required value).
5-obtain the remainder inches after getting feets.i=m%12
---------------------------------------*/
#include "stdio.h"
void input(float *);
void conversion(float *,int *,int *,int *);
void print_reults(float *,int *,int *,int *);
char another(void);
int main ()
{
float meter;
int yards,feet,inches;
do {
system("cls");
input(&meter);
conversion(&meter,&yards,&feet,&inches);
} while (another()=='y');
return 0;
}
void input(float *m)
{
printf("\nEnter size in meter :");
scanf("%f",m);
printf("\nYou have entered size in meter %.4f\n",*m);
}
void conversion(m,y,f,i)
float *m;
int *y,*f,*i;
{
m=m*100.0/2.54;
*y=m/36.0;
m=m-(*y)*36.0;
*f=m/12.0;
*i=m-(*f)*12.0;
printf("\n %.2f meter is = %4d yards %4d feet %4d inches
",*m,*y,*f,*i);
}
char another()
{
char a;
printf("\n\n Do ou want to another procees (y/n)");
scanf("\n%c",&a);
return (a);
}
sunstudi I found those errors:
"pnt02ma1.c", line 37: warning: implicit function declaration: system
"pnt02ma1.c", line 58: operands must have arithmetic type: op "*"
"pnt02ma1.c", line 58: assignment type mismatch:
pointer to float "=" double
"pnt02ma1.c", line 59: operands must have arithmetic type: op "/"
"pnt02ma1.c", line 60: operands have incompatible types:
pointer to float "-" double
"pnt02ma1.c", line 61: operands must have arithmetic type: op "/"
"pnt02ma1.c", line 62: operands have incompatible types:
pointer to float "-" double
"pnt02ma1.c", line 62: warning: improper pointer/integer combination:
op "="
cc: acomp failed for pnt02ma1.c
/*-----------------------pnt02ma1.c---------------------
Given those formulas
---inch = cm / 2.45
---inch =(meter * 100)/2.45
---feet = 12 inch
---yard = 3 feet
---yard = 36 inch
---inch = 1/12 feet
---inch = 1/36 yard
---yard > feet > inch
convert given meter value to (yards , feet , and inches)
1-convert meter to the smallest unit = (inches).
2-obtain yards (biggest required value).
3-obtain the remainder inches after getting yards. m=m%36
4-obtain feet (second biggest required value).
5-obtain the remainder inches after getting feets.i=m%12
---------------------------------------*/
#include "stdio.h"
void input(float *);
void conversion(float *,int *,int *,int *);
void print_reults(float *,int *,int *,int *);
char another(void);
int main ()
{
float meter;
int yards,feet,inches;
do {
system("cls");
input(&meter);
conversion(&meter,&yards,&feet,&inches);
} while (another()=='y');
return 0;
}
void input(float *m)
{
printf("\nEnter size in meter :");
scanf("%f",m);
printf("\nYou have entered size in meter %.4f\n",*m);
}
void conversion(m,y,f,i)
float *m;
int *y,*f,*i;
{
m=m*100.0/2.54;
*y=m/36.0;
m=m-(*y)*36.0;
*f=m/12.0;
*i=m-(*f)*12.0;
printf("\n %.2f meter is = %4d yards %4d feet %4d inches
",*m,*y,*f,*i);
}
char another()
{
char a;
printf("\n\n Do ou want to another procees (y/n)");
scanf("\n%c",&a);
return (a);
}