Ok so i already have the basis for the program down, (linked below), basically however the catch 22 is that for the first part of the assignment, for whatever reason my prof wanted us to figure out a way to repeat my overall functions down below seven times to create a final printout of 7 separate inputs, and then once we had that down go ahead and use loops.
Is there any way I can repeat my function codes without having to copy and pasta and manually edit in the pointers and variables and such? Im also assuming that if this is the only way without loops that I would have to also edit everything in my functions and thus cannot simply just state multi variables in my main.
Thanks for helping!
PS. is there a way to arrange by grid my printout thats relatively easy for a noob? ive looked it up once and it looked quite confusing.
PSS. If it helps i have a hand written function chart and can post that up.
Is there any way I can repeat my function codes without having to copy and pasta and manually edit in the pointers and variables and such? Im also assuming that if this is the only way without loops that I would have to also edit everything in my functions and thus cannot simply just state multi variables in my main.
Code:
#include <stdio.h>
void Input (float *x)
{ //accepts user input
printf("Please enter in the current salaries of the 7 employees \n" );
scanf("%f", x);
}
float cond(float x)
{ //establishes the rate of raise to be used
float r;
if (x >= 0 && x< 30000) r=.07;
if (x >= 30000 && x< 40000) r=.055;
else r = .04;
return r;
}
void calc (float x, float r, float *rs, float *rp, float *s )
{ //take what i got from cond and then multiply it to find raise rate, raise percent in terms of percent, and new salary
*rs=x*r;
*rp=r*100;
*s=x*r +x;
}
void print (float x, float rp, float rs, float s)
{ //prints the shit out.
printf(" Salary Rate Raise New Salary \n");
printf(" %f, %f, %f, %f", x, rp, rs, s);
}
void main ()
{
float x, r, rp, rs, s;
Input(&x);
r = cond(x);
calc( x, r, &rp, &rs, &s);
print(x, rp, rs, s);
getchar();
}
PS. is there a way to arrange by grid my printout thats relatively easy for a noob? ive looked it up once and it looked quite confusing.
PSS. If it helps i have a hand written function chart and can post that up.