网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

请编写一个函数resort,该函数的功能是:能在一个数列中,对从指定位置开始的几个数,按相反顺序重新排列,并在主函数中输出新的数列。

注意:部分源程序已存在文件PROC4.cpp中。

请勿修改主函数和其他函数中的任何内容,仅在函数reson()的花括号中填写若干语句。

文件PROC4.cpp的内容如下:

//PROC4.cpp

include<iostream>

using namespace std;

void resort(int array[],int where,int arrount);

int main()

{

int number[20],where, arrount,i;

cout<<"input 20 numbers\n";

for(i=0;i<20;i++)

cin>>number[i];

cout<<"how many do you want to sort:";

cin>>arrount;

cout<<"where do you want to start:";

cin>>where;

resort(number,where,arrount);

cout<<"\n resorted array as follow:\n";

for(i=0;i<20;i++)

cout<<number[i];

return 0;

}

void resort(int array[ ],int where,int amount)

{

/************/

}


参考答案

更多 “ 请编写一个函数resort,该函数的功能是:能在一个数列中,对从指定位置开始的几个数,按相反顺序重新排列,并在主函数中输出新的数列。注意:部分源程序已存在文件PROC4.cpp中。请勿修改主函数和其他函数中的任何内容,仅在函数reson()的花括号中填写若干语句。文件PROC4.cpp的内容如下://PROC4.cppinclude<iostream>using namespace std;void resort(int array[],int where,int arrount);int main(){int number[20],where, arrount,i;cout<<"input 20 numbers\n";for(i=0;i20;i++)cin>>number[i];cout<<"how many do you want to sort:";cin>>arrount;cout<<"where do you want to start:";cin>>where;resort(number,where,arrount);cout<<"\n resorted array as follow:\n";for(i=0;i<20;i++)cout<<number[i];return 0;}void resort(int array[ ],int where,int amount){/************/} ” 相关考题
考题 使用VC6打开考生文件夹下的工程RevProj8。此工程包含一个源程序文件 RevMain8.cpp。在该文件中,函数resort的功能是:能在一个数列中,对从指定位置开始的几位数,按相反顺序重新排列,并在主函数中输出新的序列。请改正程序中的错误,使它能得到正确结果。注意,不要改动main函数,不得删行或增行,也不得更改程序的结构。源程序文件RevMain8.cpp中的程序清单如下://RevMain8.cppinclude <instream>using namespace std;void resort(int arr[],int where,int amount);int main (){int number [20] ,where, arrount, i;cout<<"Input 20 numbers\n";for (i=0; i<20; i++)cin>>number [i];cout<<"How many do you want to sort: ";cin>>arrount;cout<<"\n where do you want to start: ";cin>>where;cout<<"old array as follow:\n";for (i=0; i<20; i++)cout<<nmuber [i] <<" ";resort (number,where, arrount);cout<<"\n resorted array as follow:\n";for (i=0; i<20; i++)cout<<number [i] <<" ";cout<<end1;return 0;}void resort(int array[],int where, int amount){int *pi, *p2, temp;p1=array [where-1];p2=array [where-2+amount];/* * * * *FOUND * * * * */for (;p1<array [where-1+amount/2]; ){/* * * * *FOUND * * * * */*p1=*p2;*p2=*p1;}return;}

考题 请在函数proc()的横线上填写若干表达式,使从键盘上输入一个整数n,输出斐波那契数列的前n个数。斐波那契数列是一个整数数列,该数列自第3项开始,每个数等于前面两个数之和,即0,1,1,2,3,5,8,13,21,34,55,…注意:部分源程序给出如下。请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。试题程序:

考题 请编写一个函数proc(),它的功能是将一个数字字符串转换为一个整数(不得调用C语言提供的将字符串转为整数的函数)。例如,若输入字符串“1234”,则函数把它转换为整数值1234。注意:部分源程序给出如下。请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的花括号中填入所编写的若干语句。试题程序:

考题 请编写函数proc(),它的功能是求Fibonacci数列中小于n的最大的一个数,结果由函数返回。Fibonacci数列F(n)的定义为F(0)=O,F(1)=1F(n)=F(n-1)+F(n-2)例如,n=500时,函数值为377。注意:部分源程序给出如下。请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的花括号中填写所编写的若干语句。试题程序:

考题 请补充函数proc(),该函数的功能是判断一个数是否为素数。该数是素数时,函数返回字符串:“yes!”,否则函数返回字符串:“no!”,并在主函数中输出。注意:部分源程序给出如下。请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。试题程序:

考题 10、在Excel文本函数中, 函数是从第一个字符开始向后截取指定个数的字符,而MID函数则是从指定位置开始向后截取指定个数的字符。

考题 C++程序的执行总是从哪里开始?A.从main()函数开始执行;B.从用户指定的函数开始执行;C.从整个程序中的第一个函数开始执行;D.从系统中的库函数开始执行;

考题 9、以下说法错误的是A.fgetc()函数的功能是从文件读取一个字符数据B.fgets()函数的功能是从文件读取一个字符串C.fscanf()函数的功能是按照指定格式读取二进制文件中的数据D.fread()函数的功能是从指定文件读取一个数据块

考题 以下说法错误的是A.fgetc()函数的功能是从文件读取一个字符数据B.fgets()函数的功能是从文件读取一个字符串C.fscanf()函数的功能是按照指定格式读取二进制文件中的数据D.fread()函数的功能是从指定文件读取一个数据块