-
What exactly do you want to do? Look at your program is to calculate the even and odd numbers of each digit in the statistics. But the program is wrong again. The result can only be obtained if the input number has 1 even digit and 2 odd digits, otherwise it is an infinite loop.
What do you want everyone to change?
-
123/2=61
The result of integer division is an integer, and if it should be a decimal, only the integer part is taken.
The result of the division of floating-point numbers and integers is floating-point numbers.
So o( o
-
Floating-point numbers are automatically converted to integers are rounded down, got it?
-
123 2 results in 61 because both sides of '' are integers.
And if you use the %f format to output the result as.
This is because it is a floating-point type, and when it is calculated, 10 will also become floating-point, and then the calculation will be carried out, and the result will also be floating-point.
-
1 Design a program, enter 123, return 1+2+3, which is the sum of three numbers 6, enter -123 is also the sum of three numbers, is 6
#include
int add(int n)
return sum;
int main(void)
2 Design the program, enter 123, return 321. Enter -123, return 321
#include
int reverse(int n)
return m;
int main(void)
-
Use an array to store these three numbers, and then swap the first and last numbers to complete the order output! As for the sum of outputs, it would be good to just sum them up!
-
Take the absolute value of the number through abs, and then find the remainder through the %, separate the single digit, the ten, the hundred, and then add it if you want to add it and convert it if you want to...
-
#include ""//
#include ""//
void main(void)
There's another way that's good, you can choose one-
void main(void)
Don't give it if you don't give it, don't care about ......
-
Because no matter how big the initial number is, it will end up in three digits, and the following is assumed:
Even 3 --213---123 odd odd 3 --033---123 even 3 --123
Odd and even 3 --123
-
132 can come out.
You're running and seeing.
123 is no.
Because the three digits a, b, and c are not the same to be output, 111 222 333 444 is not.
Then it is a cycle starting from 1 and each for at least 3 cycles.
Personally, I don't think 123 is because.
for is a cycle from a to c exactly 1 time each, in which case it should be 111
But there is if(a!=c&&a!=b&&c!
b) condition: So no output Then c then for c+1 is 112 not satisfied, up b's cycle +1 is not satisfied, then b is +1 again 132 output is ture, then c loops down, 133 (not satisfied), then 134 (ture), 4<5 up from 2, where 123 jumps away.
This is my personal opinion, if it's wrong, please correct it.
-
How not. I'll just compile it with a vc.
-
func read *s =='c'The loop exits.
-
Because his laws determine everything about him!
So, it's 123, not 12345
-
include void main() This is the explicit scattering of a character after entering a character, and if it needs to be modified, it will be said.
I'll fix it, friend, I don't want to divide it, hehe.
r=0; c=1;It is to assign an initial value to r and c. >>>More
The main thing is that you put this line using namespace std; Put it in main(), and then call cout to output it, so you should put it in front, or add it directly to the header file. h can be used, or it can be placed in front of the function in which iostream is called. Such as: >>>More
I think lz just wants to print out the address of a and the address of a+1 Here, a is the starting address of the array, so &a takes the address with a as a variable, that is, the address that stores the address of the array, but if (a+1) is addressed, it is not right, because (a+1) is not a defined variable here, but the value of a temporary variable, it is only equal to the value of the next address of the starting address of the array, not a variable that stores the value, and it is not right to take the address. >>>More
The reason is that you declare that the totleweight() function is a friend function of car, but you do not declare that it is a member function of boat, so you cannot directly access the private data members of the boat class.
#pragma once
#include >>>More