Support Forums
Help with programming C - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Programming with C++ (https://www.supportforums.net/forumdisplay.php?fid=20)
+---- Thread: Help with programming C (/showthread.php?tid=3261)



Help with programming C - z3rO88 - 12-01-2009

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


RE: Help with programming C - g4143 - 12-01-2009

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..


RE: Help with programming C - MrD. - 12-01-2009

Not sure, my policy is "no", especially when they don't use code tags to keep the formatting somewhat decent Smile


RE: Help with programming C - uber1337 - 12-02-2009

(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.


RE: Help with programming C - g4143 - 12-03-2009

(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..


RE: Help with programming C - MrD. - 12-03-2009

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.


RE: Help with programming C - z3rO88 - 12-04-2009

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