Support Forums

Full Version: Help with programming C
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi i am doing a program at the minute i need help because i do not know how to do a bit which i need to do for the program.

Question: update the designs and the program to include overall totals and display these as follows

Number Severance
Male xxx xxxxx.xx
Female xxx xxxxx.xx
Total xxxx xxxxxx.xx


The program which i have coded at the minute is:


#include <stdio.h>

const float afemale=40;
const float amale=45;
const float mmale = 'M' || 'm';
char gender,yn;
float salary,sev,monthly,number,total,tmale,tfemale,tsevm,tsevf,tsev,ot,osev;
int age, years;

main()
{
do
{
printf("\n\n\t\t How old are you? ");
scanf("%d",&age);
getchar();
printf("\n\n\t\t What Gender are you M/F? ");
scanf("%c",&gender);

if(mmale<=sev)
{
tmale=mmale;
}

printf("\n\n\t\t Total salary ");
scanf("%f",&salary);
printf("\n\n\t\t How many years ");
scanf("%d",&years);
getchar();

monthly=salary/12;

if(gender == 'm' && age==amale || gender == 'f' && age==afemale ||
gender == 'M' && age==amale || gender == 'F' && age==afemale)
{
sev = salary/52 *2*years; /* one week *2 = 2 weeks*/
}
else
sev = salary/52*years;

if(sev<monthly)
{
sev=monthly;
}
printf("\n\n\t\t Total %6.2f ",sev);
getchar();

do
{
printf("\n\n\t\t Another sequence Y/N? ");
scanf("%c",&yn);
getchar();
} while(yn!='Y' && yn!='N' && yn!='y' && yn!='n');
} while(yn=='Y' || yn=='y');

{
printf("\n\t number Severance ");
printf("\n\n\t Total male %12.2f \b\b\b %12.2f \b\b\b ",tmale,tsevm);
printf("\n\n\t Total Female %12.2f \b\b\b %12.2f \b\b\b ",tfemale,tsevf);
printf("\n\n\t Total Overall %12.2f \b\b\b %12.2f \b\b\b ",ot,osev);
}
}


Can anybody help me get it to add the full male totals and female + overall total Big Grin
Sounds like homework to me:

"Question: update the designs and the program to include overall totals and display these as follows "

I'm not sure what the forums policy is on homework questions..
Not sure, my policy is "no", especially when they don't use code tags to keep the formatting somewhat decent Smile
(12-01-2009, 02:39 PM)g4143 Wrote: [ -> ]Sounds like homework to me:

"Question: update the designs and the program to include overall totals and display these as follows "

I'm not sure what the forums policy is on homework questions..
Hey! It's called SUPPORT Forums for a reason. The forum rules have nothing against it and people have been helped with homework before on this forum and the admins/mods didn't complain. In this case it's really up to the individual, I personally think that if people do it on their own they actually learn.
(12-02-2009, 07:07 PM)uber1337 Wrote: [ -> ]Hey! It's called SUPPORT Forums for a reason. The forum rules have nothing against it and people have been helped with homework before on this forum and the admins/mods didn't complain. In this case it's really up to the individual, I personally think that if people do it on their own they actually learn.

Yes the word is "helped", I have no problems helping someone who has a specific question but to post a assignment question and ask someone to solve it well that's different..
Also, under academic law it counts as plagiarism to get someone else to do your work for you. So all in all, it's not a good idea.

Asking for help with an aspect of something is one thing, asking for a complete solution is completely different.
sorry i kinda put it a bit wrong i wanted like help but not for you to do the whole program just where do i put the calculations and the end statement but never mind i done it now + it doesn't matter aslong as i understand the stuff Big Grin

but thanks anyhow next time ill post but only ask for help as in guideness sorry that i put it wrong terms really
Smile