Hello guys!
Okay so I'm making a student budget program for class its a basic program using functions and pointers. Here is the template they want us to start with:
Code:
main() {
float school, living, transp, otherExp;
float employ, otherInc;
get_expenses(&school, &living, &transp, &otherExp); get_income(&employ, &otherInc);
display_report(school, living, transp, otherExp, employ, otherInc); return;
}
void get_expenses(double* pSchool, double* pLiving, double* pTransp, double* pOther) {
*pSchool = *pLiving = *pTransp = *pOther = 0; return;
}
void get_income(double* pEmploy, double* pOther) {
*pEmploy = *pOther = 0; return;
}
void display_report((double School, double Living, double Transp, double OtherExp, double Employ, double OtherInc) {
return;
}
I'm working on the first function on Xcode
Code:
void get_expenses(double* pSchool, double* pLiving, double* pTransp, double* pOther)
And right away I'm getting an error stating: Conflicting types for 'get_expenses'
...? Not sure what that means.
And after that I'm just adding the scanf's
Code:
printf("What is the tuition cost?");
scanf("%d", %tuition);
printf("What is the textbook cost?");
scanf("%d", %textbook);
printf("What is the school supplies cost?");
scanf("%d", %tuition);
But I realize those are not declared? Should I add global declarations for all my scanf's are is there a easier way I'm not getting
The output should show:
School Expenses: ~~~~~~~~~~~~~~
Tuition (per semester): 1800
Textbooks(per semester): 160 Supplies: 20
Living Expenses: ~~~~~~~~~~~~~
Residence/Rent/Mortgage: 400
Utilities: 50
Phone/Internet: 90
Groceries/Eating out: 200
Entertainment: 50
Transportation: ~~~~~~~~~~~~~
Public Transportation: 104
Car: 0 Auto Insurance: 0
Gas/Maintenance: 0
Other:~~~~~
Any other expenses: 200