already answered: # C programming I need to write the header corresponding to th
ID: 3813147 • Letter: A
Question
already answered:
#
C programming
I need to write the header corresponding to the function that is carried out by each one of the foillowing tasks. And yup, only the header though, I'll try to implement myself the line codes.
And yup, I think we could use , or at leats have defined type tBool in order to store booleans.
a) translateText : Action that reads a text typed in in english (input) and it gives the translation in chinese (output)
b) isLeapYear : ( I have it done)
c) updateAccont : Action that once given an statement of how much money we have in our bank account a date of 01.01.2015 and how much we have spent a date of 31.01.2015 gives me back my balance updated.
#ifndef TRANSLATE_H_ /* Include guard */
#define TRANSLATE_H_
char* translateText(char* text);
/* Takes a pointer to the text string and returns a pointer to the chinese text Function declaration */
/*It can be printed from within the function : void translateText(char* text) */
#endif // TRANSLATE_H_
#ifndef LEAPCHECK_H_ /* Include guard */
#define LEAPCHECK_H_
bool isLeapYear(int year);
/* Function declaration assuming year is passed as int , would return true or false */
#endif // LEAPCHECK_H_
#ifndef UPDATEACCOUNT_H_ /* Include guard */
#define UPDATEACCOUNT_H_
double updateAccont(double bal,double spent);
/* Takes balance on 01.01.2015 and amount spent till 31.01.2015 returns balance left */
#endif // UPDATEACCOUNT_H_
Names of headers are : translate.h , leapcheck.h , updateaccount.h
Explanation / Answer
translate.h:
#ifndef TRANSLATE_H_ /* Include guard */
#define TRANSLATE_H_
/* Takes a pointer to the text string and returns a pointer to the chinese text Function declaration */
/*It can be printed from within the function : void translateText(char* text) */
char* translateText(char* text);
#endif // TRANSLATE_H_
leapcheck.h:
#ifndef LEAPCHECK_H_ /* Include guard */
#define LEAPCHECK_H_
/* Function declaration assuming year is passed as int , would return true or false */
bool isLeapYear(int year);
#endif // LEAPCHECK_H_
updateaccount.h:
#ifndef UPDATEACCOUNT_H_ /* Include guard */
#define UPDATEACCOUNT_H_
/* Takes balance on 01.01.2015 and amount spent till 31.01.2015 returns balance left */
double updateAccont(double bal,double spent);
#endif // UPDATEACCOUNT_H_
Also, in each of the header file, don't forget to include the header file corresponding to tBool, if defined inside some other header file.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.