Hi all,
I need help debugging my homework. It is due tonight and I have been working on it for 2 days. I can't figure out how to
1. reduce the float variables to dollar format example: $5.00 instead of 5.000000
2. Am I not declaring the functions right? I have 4 functions and I am trying to call them from the main function.
3. I am using MS Visual C++. I have also tried Miracle C and I can't seem to get it to work with either.
4. I am not sure if I have included all the required files.
Here is the following errors:
C:\Documents and Settings\Administrator\Desktop\exam3.c(24) : warning C4013: 'Printf' undefined; assuming extern returning int
C:\Documents and Settings\Administrator\Desktop\exam3.c(52) : warning C4244: 'return' : conversion from 'float ' to 'int ', possible loss of data
C:\Documents and Settings\Administrator\Desktop\exam3.c(61) : error C2143: syntax error : missing ';' before 'type'
C:\Documents and Settings\Administrator\Desktop\exam3.c(62) : warning C4047: '>=' : 'int (__cdecl *)(float ,float )' differs in levels of indirection from 'int '
C:\Documents and Settings\Administrator\Desktop\exam3.c(65) : warning C4550: expression evaluates to a function which is missing an argument list
C:\Documents and Settings\Administrator\Desktop\exam3.c(65) : warning C4047: 'return' : 'int ' differs in levels of indirection from 'int (__cdecl *)(float ,float )'
C:\Documents and Settings\Administrator\Desktop\exam3.c(92) : warning C4244: '=' : conversion from 'int ' to 'float ', possible loss of data
C:\Documents and Settings\Administrator\Desktop\exam3.c(93) : warning C4244: '=' : conversion from 'int ' to 'float ', possible loss of data
C:\Documents and Settings\Administrator\Desktop\exam3.c(95) : error C2063: 'total' : not a function
C:\Documents and Settings\Administrator\Desktop\exam3.c(97) : error C2115: 'function' : incompatible types
C:\Documents and Settings\Administrator\Desktop\exam3.c(97) : warning C4024: 'show' : different types for formal and actual parameter 1
C:\Documents and Settings\Administrator\Desktop\exam3.c(97) : error C2115: 'function' : incompatible types
C:\Documents and Settings\Administrator\Desktop\exam3.c(97) : warning C4024: 'show' : different types for formal and actual parameter 2
C:\Documents and Settings\Administrator\Desktop\exam3.c(97) : error C2115: 'function' : incompatible types
C:\Documents and Settings\Administrator\Desktop\exam3.c(97) : warning C4024: 'show' : different types for formal and actual parameter 3
Error executing cl.exe.
exam3.exe - 5 error(s), 10 warning(s)
Any help or suggestions would be GREAATTTLLLYY APPRECIATED.
Thanks in advance.
/* ********* Compiler: MS Visual C++************** */
PHP Code:
#include <stdio.h>
getfloat(float minimum, int calltype){
float amount;
if (calltype == 1){
printf("\nPlease enter the Amount for Raffle Ticket");
scanf("%f",amount);
while (amount < minimum){
Printf("\nInvalid Amount! Please Enter Amount greater than $%1f", minimum);
scanf("%f",amount);
}
}
if (calltype == 2){
printf("\nPlease enter the Number of Raffle Ticket");
scanf("%f",amount);
while (amount < minimum){
Printf("\nInvalid Number! Please Enter Number greater than %1f", minimum);
scanf("%f",amount);
}
}
return amount;
}
total(float numoftix, float amount) {
int max;
max = 500;
float total = numoftix*amount;
if(total>=max) {
return max;
} else {
return total;
}
}
show(float numoftix, float amount, float total) {
printf("\nYou purchased %1f tickets at %1f each, for a total of $%1f\n", numoftix, amount, total);
}
main() {
float amount, numoftix, total;
amount = getfloat(5.00,1);
numoftix = getfloat(0,2);
total(&numoftix,&amount);
show(&numoftix,&amount,&total);
}
--------------------------------------------------------------------------------