-
Question 1: pt1=&a;pt2=&b;pt1 and pt2 are not defined, years are defined as.
int*pt1, *pt2, and then there is *pt1=a; *pt2=b.
The 2nd. #include ""
#include ""
void fun( 1) int *d parameter.
d=fabs(*d);}
main()
int n,a[10],*p=a;
for(n=0;n<10;n++)
scanf("%d",p++)
_2)__p=a;Relocate to the start of the array.
while(p___3)__if(*p<0) fun(p++)else p++;Judge and correct.
for(n=0;n<10;n++)
printf("%5d",a[n]);
-
The first. main()
int a,b;
int *p,*q;It was not defined just now.
scanf(“%d,%d”,&a,&b);
pt1=&a;pt2=&b;
if(aprintf(“%d,%d”,*pt1,*pt2);
The 2nd. #include ""
#include ""
void fun( 1) int *d parameter.
d=fabs(*d);}
main()
int n,a[10],*p=a;
for(n=0;n<10;n++)
scanf("%d",p++)
_2)__p=0;Relocate to the start of the array.
while(p___3)__if(*p<0) fun(p++)else p++;Judge and correct.
for(n=0;n<10;n++)
printf("%5d",a[n]);
-
Let's start with the answer: the first cryptofiber is empty.
c[k] =a[i]; i++
The second vacant beam.
b[j]; j++
The third is empty.
Let's talk about the idea: first of all, we know that i and j represent the indexes of a and b respectively, since the smaller ones are used first, then if a[i] is smaller than b[j], then a[i] must be used.
For example, in the first comparison, a[0] then there isc[k] =a[i];
There is no autoincrement for i or j elsewhere after the comparison, and a[0] has already been written to the c[0] position, so the next comparison should be made using a[1] and b[0] again, so it needs to be donei++Operate.
After the end of if, don't go else, go directly to k++, so the next thing is to see what the number c[1] is.
Perform one more finding a[1] and then look at the else section, and go to a[2] vs. b[0] and find that is.
a[2] >b[0], so c[2] should use b[0], so use c[k] =b[j] for the smaller answer.
Then, as with a, you need to ++ for j and compare a[2] with b[1] next time, and after k++ is over, the next time c[3] is determined whether c[2] or b[1].
When all judgments are over, the two chars have been arranged in order into c, and the k coordinates at this time are still ++ once after the last judgment, pointing to.
len(a+b)+1.
Therefore, the last one should be filled in according to the C specification'\0'Make the end of the string.
-
The first one is filled.
The second blank fills in 1
The third blank fills the endl
The complete C++ procedure is as follows.
-
1 A C source program should include at least one main function
2 If a is of type int and the initial value of a is 6, then the value of a is 60 after the expression a+=a-=a*a is calculated
3 If defined: intb=7;float a=,c=;then the value of the expression a+(int)(b 3*(int)(a+c) 2)%4 is .
4 If a is an integer variable, then the value of the expression (a=4*5, a*2), a+6 is 26
5 After the following program is executed, if you enter 1289 from the keyboard, the output result is 9821
main()
6 When calling a library function in C to manipulate a string, the header file that should be included is
In the whole main function, only this one variable, whether it is the first for or the second for, is the same i, the second for will have i=-1, in the case of i= -1, and printf("%d ",a[i]);Statement. So fear not! When there is no second for the case: >>>More
C language in computer software (Windows platform) programming.
If the landlord is looking for the textbook for the class, it is not helping the landlord, the book is not good, and no one has to do the electronic version. >>>More
Define an array of scores to record scores, record rankings and score bins. >>>More
The reason why the exe stops working when the C program runs is because of a memory overflow and a compiler error. >>>More