Home > Back-end >  Novice just learning C language, for a great god a question
Novice just learning C language, for a great god a question

Time:10-03

[b] [/bI. First question: Numerical comparative Judgment (Numerical Comparison and Judgment)

Please enter a 2 digit (a number with two who), and make the following judgment (judgment) :
(1) the number of digits (ones) are greater than 10 digits (tens) (note: do not contain equal to)?
If so, single digits (ones) and 10 digits (tens) position switch (exchange positions). If not, the single digits (catalog) replaced by ten digits (ones) (home), and show the new two digits (display the new number),
Ex: (1) the 16-61, (2) 76-77, 33 (3) - 33,
(2) according to the result of (1), a new two digits of its single digits (catalog) and the sum of ten digits (tens) (sum) of 12 multiples (multiple of 12)?
If so, divided by 3, as a result; If not, then in the single digits and ten large number divided by the smaller number of remainder as the result (if the two Numbers is equal division modulo as a result), finally shows the results (display the calculated result),
39-39/3=13, Ex: (1) (2), 74-7%=3, 4 (3) the 55-5% 5=0,
II. The second question: 2 d Graphics Area computation (Area Calculation of Two - Dimensional Graphics)

Xiaowen wanted to design a program to help him calculate the area of the 2 d graphics, the 2 d graphics (two - dimensional graphics) may be trapezoid, trapezoid, triangle (triangle), a square (square) or does not constitute a graphics (not graphics), you can design a graphic types (graphics judgment) and calculate the graphics area (area calculation) program,
Please design a program can satisfy the above condition and calculate the area,
(1) the user can enter 2 d graphics (two - dimensional graphics) on the bottom, the bottom (outside) and altitude (height), the three variables (3 variables), such as unreasonable input numerical displays input error and the end of the program,
Ex: on the bottom (top) - 3, the bottom (bottom) of 5, altitude (height) for seven, according to the input error (display the error message) and the end of the program,
(2) according to the input on the bottom, the bottom (outside) and altitude (height), determine the pattern of the different type and output graphics area,
Ex: on the bottom (top) to 0, the bottom (bottom) of 5, altitude (height) of 7, then the graphics for the regular triangle (regular triangle), program output area of 35/2,
(3) to judge the type of graphics for the regular triangle, triangle, square, trapezoid and does not constitute a graphics,
(4) triangle, the representation of the area of the trapezium for: (x)/2, [(bottom) under bottom + x high]/2,

CodePudding user response:

I don't want to do myself homework?

CodePudding user response:

CodePudding user response:

Yesterday to get done first in the middle of the night, the second question is really weak...

CodePudding user response:

Seem to be very complicated, you may find myself is easy

CodePudding user response:

Why do you want to write traditional Chinese characters? So tired

CodePudding user response:

 
# include & lt; stdio.h>

Double top and bottom, height, s;
Int shapename;
Enum shapes {zhengsanjiaoxing, daosanjiaoxing tixing, zhengfangxing, nographics};
Char STR [] [20]={
"Regular triangle",
"Del",
"Trapezoid",
"Square",
"Do not constitute a graphic
"};

Int input ()
{
Printf (" please enter the graphic on the bottom, bottom, under highly (for example: 10 20 15) : ");
Lf the scanf (" % % % lf lf ", & amp; Top, & amp; Bottom, & amp; Height);

//printf (" top=% lf, bottom=% lf, height=% lf \ n ", top, bottom, height);
}
Int judge ()
{
Float delta;

If (top & lt; 0 | | bottom & lt; 0 | | height & lt;=0)
Shapename=nographics;
Else if (0==top & amp; & 0==bottom)
Shapename=nographics;
The else
{
If (0==top)
{
Shapename=zhengsanjiaoxing;
}
Else if (0==bottom)
{
Shapename=daosanjiaoxing;
}
Else if (height==bottom & amp; & Height==top)
{
Shapename=zhengfangxing;
}
The else
{
Shapename=tixing;
}
}
Printf (" shape determination: % s \ n ", STR [shapename]);
}
Int calculate ()
{
S=(top + bottom) * height/2;
If (nographics!=shapename)
{
Printf (" size=% lf \ n ", s);
}
}

Int main (int arg c, char * argv [])
{
The input ();
Judge ();
Calculate ();

return 0;
}


Is that ok?

CodePudding user response:

Why don't stick to points,

CodePudding user response:

refer to 7th floor syrchina response:
why don't knot stickers to ah,

He didn't know a knot it, long forgotten,

CodePudding user response:

refer to the eighth floor jennyvenus response:
Quote: refer to 7th floor syrchina response:

Why don't knot stickers to ah,

He didn't know a knot it, long forgotten,

Mulberry heart!
  • Related