-
The characteristic of shaping is to discard the number after the decimal point, no matter how big or small, even if it is. The same goes for 9.
Therefore, when using floating-point operations and division operations, you should use floating-point or double-precision floating-point operations.
There are quite a few such questions in the Level 2C exam.
To put it simply, this loop statement is weighted and assigned.
for(i=1;i<=n;i++)
item=x2/x1;
sum+=item;
x=x1+x2;
x1=x2;
x2=x;n=2, the first round of cycle:
i=1 item=x2/x1=
sum=item+sum=2+0=
x=x1+x2=
x1=x2=
x2=x=Second Cycle:
i=2 item=x2/x1=
sum=item+sum=
x=x1+x2=
x1=x2=
x2=x=This is where the problem can be seen.
If it's an integer, it becomes.
item=x2/x1=
sum=item+sum=
x=x1+x2=5
x1=x2=3
x2=x=5
and 3, the problem lies in the decimal places generated by the division operation.
Therefore, use floating-point instead of integer.
item=x2/x1
The result of the division here is:
floating-point = (cast type conversion) (integer integer).
Suppose x2 = 3 and x1 = 2
item=x2 x1=instead of.
Because the result of x2 x1 is an integer, the result is taken as 1
It is then converted to floating-point type.
So i,n can be defined as integers.
Nothing else
-
If the integer number in the C C++ language involves division operations, the result after the decimal point will be omitted (this is determined by the characteristics of its data type), so it is generally not used when it comes to division. Unless it is really realistic (e.g. when counting people, there is no decimal, it can be used).
-
That one is related to your output format.
-
sss is the function that calls the first argument.
And so it is.
x=funa(9,3)=12
x+=funb(8,3)=5
x=12+5=17
Therefore, choosing C is the simplest application of function pointers, as long as you understand function pointers, this problem is not difficult.
-
The answer is c, after the first call to funa x = 12, the second funb returns 5 and 12 + 5 = 17
This year is the year of the auspicious star of the zodiac ox friends, the zodiac ox in the palace has a good omen wearing purple clothes, this year's fortune is profitable, thanks to the protection and help of nobles, so that the cause of the higher level. This year's Tai Sui Mao Mu is a feminine wood of flowers and plants, and the ugly soil of the Zodiac Ox is moist wet soil, which can moisten the flowers and plants of Mao Rabbit Tai Sui, and the branches and leaves are lush and multiplying, so the Mao Rabbit Tai Sui has the grace of nurturing, and will get Tai Sui's gratitude and favor. Therefore, there are many opportunities for the zodiac ox in this year, the development space is larger, there are many nobles to help each other, there are great achievements in the career, the wealth is quite rich, the marriage is also happy and emotional, and there is a good marriage and beauty. >>>More
Troubleshoot Stop 0x9f error messages in Windows.
The "Stop 0x0000009f Driver Power State Failure" error message may appear in Windows. >>>More
Fortune telling? Or is it nothing.
That can only show that he is really unlucky, and he is about to go out of business just after joining the company, but generally speaking, the company he is about to collapse will generally not recruit new people, but will dismiss some people with lower levels, leaving some important personnel of the company, that is, those with a higher level in the company and a little more salary. Haha, if you really encounter this, I feel that all the unfortunate things have happened to me, and it will be the same feeling as the girlfriend I just talked about, and it didn't take long for me to break up.
I use nylon strings imported from Germany, a set of 800, and it should be the best now. >>>More