Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Pray for the gods of C and C++! ! ! ! ! Help me look at the program, hoping to help me correct VC error 4 1 0.0.
Pray for the gods of C and C++! ! ! ! ! Help me look at the program, hoping to help me correct VC error 4 1 0.0.
# include & ltiostream.h & gt

# include & ltstdio.h & gt

typedef? struct? _ratim? //Here, specifically distinguish yourself from my previous answer. If you don't, you must use the struct keyword before using it.

{

int? Molecule;

int? Denominator;

} ratim

int? gcd(int? x,int? Y)// Euclid uses division to find the greatest common divisor of two numbers.

{

if(x & lt; y)

Return? gcd(y,x);

if(x%y! =0)

Return? gcd(y,x % y);

Or what? Return? y;

}

int? count(int? a,int? b,int? S)// Calculate addition, subtraction, multiplication and division

{

int? Plus sign, minus sign, time; //Addition, subtraction and multiplication

plus = a+b;

Printf ("The sum of two rational numbers is: %d\\%d\n", plus, s); //Add

Minus = a-b;

Printf ("Find the reduction of two rational number pairs: %d\\%d\n", minus, s); //minus sign

Time = a * b;;

Printf ("Multiply two rational numbers: %d\\%d", time, s); //Multiply

Printf ("The division of two rational numbers is: %d\\%d\n", a, b); //division

Return? 0; //You must return a value.

}

int? Master ()

{

ratim? k 1;

ratim? k2;

int? Lcm// Least common multiple

Printf ("Please enter the numerator and denominator of the first rational number: \ n");

do

{

CIN & gt; & gtk 1. Molecule & gt& gtk 1. Denominator;

If(k 1. denominator ==0)

Printf ("The data is illegal, please re-enter!" );

} while(k 1 . denominator = = 0);

Printf ("Please enter the numerator and denominator of the second rational number: \ n");

do

{

CIN & gt; & gtk2. Molecule & gt& gtk2. Denominator;

If(k2. Denominator ==0)

Printf ("The data is illegal, please re-enter!" );

} while(k2 . denominator = = 0);

Lcm=(k 1. molecule *k2. molecule) /gcd(k 1. molecule, k2. molecule); //Least common multiple

K 1. Denominator =lcm/k 1. Molecule *k 1. Denominator;

K2. Denominator =lcm/k2. Molecule *k2. Denominator;

K 1. Molecule = lcm

K2. Molecule = lcm

Printf ("These two rational numbers are:% d/%d,% d \% d \ n", K 1. numerator, K 1. denominator, K2. numerator, K2. denominator);

Count(k 1. numerator, k2. numerator, k 1. denominator);

Printf ("The greatest common divisor of two rational numbers is:% d \ \% d \ n", GCD (K 1. numerator, K2. numerator), K 1. denominator);

Return? 0; //You must return a value.

}