c++问题 找不到出错的地方!!!

来源:百度知道 编辑:UC知道 时间:2024/05/27 06:45:00
#include <iostream.h>
class student
{ public:
student(int n,float s):num(n),score(s){} //等价于student(int n,float s) {num=n;score=s;}
void change(int n,float s) {num=n;score=s;}
void display(){cout<<""<<score<<endl;}
friend void fun(student &std);
private:
int num;
float score;
};
void fun(student &std)
{
std.change(int &n,float &s);
{
std.change(101,80.5);
}
std.display();
}
void main()
{student stud;
fun(student &stud);
stud.change(101,80.5);
stud.display();
}

--------------------Configuration: ccc - Win32 Debug--------------------
Compiling...
ccc.cpp
c:\documents and settings\computer\桌面\ccc.cpp(14) : error C2144: syntax error : missing ')' before type 'int'
c:\documents and settings\computer\桌面\ccc.cpp(14) : error C2660: 'change' :

#include <iostream>
using namespace std;

class student
{ public:
student(){}
student(int n,float s):num(n),score(s){} //等价于student(int n,float s) {num=n;score=s;}
void change(int n,float s) {num=n;score=s;}
void display(){cout<<""<<score<<endl;}
friend void fun(student &std);
private:
int num;
float score;
};

void fun(student &std)
{
//std.change(int n,float s);
//{
std.change(101,80.5);
//}
std.display();
}
void main()
{
student stud;
fun(stud);
stud.change(101,80.5);
stud.display();
}
注:
1、student stud;定义对象时缺少对应的构造函数。
2、引用并不是指针,而是一个变量的别名。
作为函数参数时,实参直接用变量,而不是变量的地址

--------------------Configuration: For_testing - Win32 Debug--------------------
Compiling...
For_testing_main.cpp
e:\My_Documents\my_Cpp\For_testing\For_

c++问题 找不到出错的地方!!! 我的电脑为什么启动地提示:加载C:\WINDOWS\system32\mcdsrv16_071028.dll时出错找不到指定的模块 加载C:\Program时出错,找不到指定的模块 加载c:\Documents时出错找不到指定的模块。 如何解决下面的问题 加载 C:\WINDOS\system32\sdmAgent23.dll 时出错找不到指定的模块 十万火急!如何解决“加载c:\system32\nllivt59.dll时出错,找不到指定的模块”的问题? 如何解决 加载C:\WINDOWS\system32\borrch97.dll时出错找不到指定的模块 的问题 问题:C:\PROGRA~1\TENCENT\Addrplus\QAHook.dll时出错找不到指定的模块? c:\windows\downlo~1\Cnsmi.dll时出错找不到到指定的模块是什么问题呀! 电脑问题 开机出现c;\windows\system\wmicsmgr.dll时出错找不到指定的模块