2.03 作业

一、选择题

1-4        CCCB

二、填空题

1.传参

2.C++

3.using namespace std

4.int i=32

a>=65 && a<=90

5.i=E6

三、编程题

3.1

2.03 作业_第1张图片

f(‘A’)错误,重载函数中没有char类型

 f(10, 23.4)错误,第一个参数是int,第二个是double类型的没有

3.2

代码:

#include 
#include 
using namespace std;

int Plus(int x, int y)
{
    return x+y;
}
string Plus(string x, string y)
{
    return x+y;
}
double Plus(double x, double y)
{
    return x+y;
}


int main()
{
    int n= Plus(3,4);
    double d = Plus(3.2,4.2);
    string s = Plus("he", "llo");
    string s1 = "aaa" ;  string s2 = "bbb";
    string s3 = Plus(s1,s2);
    cout << n << endl;
    cout << d << endl;
    cout << s << endl;
    cout << s3 << endl;
    return 0;
}

运行结果:

2.03 作业_第2张图片

你可能感兴趣的:(数据结构)