I would like to know how to write the contents of a given function based on the following conditions.
Program requirements1. Definition of structure fraction (with int type member variables numer and denom)
2. Create a function mul that multiplies fractions
・ The arguments of the function mul are the variables a and b of the structure fraction type.
-The return value of the function mul is the result of multiplication a * b in the meaning of a fraction (however, it is not necessary to divide it)
3. Create a print function to display the value of the structure fraction type
-The argument of the function print is the variable a of the structure fraction type.
-The return value of the function print is none.
Example: If 1/3, display as 1/3.
4. Prepare a variable of the appropriate structure fraction type in the main function, and check whether the function mul works properly using the print function.
Applicable source code#include<stdio.h>
typedef struct fraction {
int numer;
int denom;
};
int mul () {
}
void print () {
}
int main () {
}
I've worked on the code myself, but I don't understand how to put structure arguments because there are multiple parts that I don't understand.
-
Answer # 1
Related articles
- c language function creation problem
- when "*" is included in the argument of the c language function
- about the c language scanf function
- about the comparison function of c language bsearch function
- return value of c language function
- about c language structure, typedef
- [c language] i want to implement a function that displays the data inserted in the binary tree in ascending order
- about c language list structure
- c language: a function with variable length arguments, the pointer address values are not linked well
- c language, if statement structure
- c language swap function does not work well
- c language 16-bit multiplier creation
- c language self-made boot loader function stops working when newly defined
- c language output function printf variable usage problem
- pointer reference in c language structure
- c language, function calls including pointers
- c language gpa calculation function
- call a function in a c language function
- i am practicing my own function in c language
- c language self-referential structure
- i want to create and call a function
- c language output function printf variable usage problem
- the more command called by the exec function does not end
- [c] do not include unused functions in the executable file
- c - program that repeats 1000000 times and adds up all trials
- i want to create a function that gets the date and time and displays it
- i want to know the contents of compilation errors and warnings
- i want to set the tens place and the ones place of items of 10000 yen or more to 0
- c - i want to set the 10's and 1's to 0 for items with a tax of 10,000 yen or more
- c++ - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Declaration only for the time being