C语言救助

来源:百度知道 编辑:UC知道 时间:2024/05/09 20:39:58
编写函数 int fun(int *a,int *b) ,函数的功能是判断两个指针a和b所指存储单元的值的符号是否相同,
若相同函数返回1,否则返回0。/要求:这两个存储单元中的值都不为0,在主函数中输入2个整数,调用函数fun,输出结果。
****************************************************************************************************
编写函数 void max(int *a,int *m),
函数的功能是求数组a的最大值,在主函数中输入10个整数,调用函数fun,输出结果。
****************************************************************************************************
/编写函数,int xcopy(int *a,int *b,int n),
/函数的功能是把数组a中所有为偶数的数,放在另一个数组b中。
形参n是数组a中元素的个数,函数返回偶数的个数
****************************************************************************************************
小学生数学测试软件的编写,要求:
(1) 可选择题型(+,-,*);
(2) 可选择每次答题的个数;/ (3) 每次输入答案后应判断对错,若答案错误,应给出正确答案;
(4) 最后给出做对题目的总个数。
(5) 做两位数的运算
要求在VC++6.0下编写,不要太抽象了。。。

//用c++给你做了最后一道
#include <stdlib.h>
#include<iostream>
#include<time.h>
#include<string>
using namespace std;
//#define swap(a,b) ( int _swap = a; a = b; b = _swap;) //交换

/*
*
*/
int main(int argc, char** argv) {
while (1) {
srand(time(NULL));
char choice = 0;
char s_num[20] ;
int num = 0;
int answer = 0;
int your_answer = 0;
int correct = 0;
int problem_left = 0;
int problem_right = 0;
cout << "输入题量\n";
cin >> s_num;
num = atoi(s_num);
int i = 0;
if(num<=0)
num = 1;
for (; i < num; i++) {
cout << "选择 + - * \n";
cin >> choice;
if (choice != '+' && choice != '-'