请阅读我的代码,并帮我调试它.因为Dev-C++发现了很多错误....
#include<iostream.h>
#include<conio.h>
using namespace std;
struct iWorker{
double salary;
}
double calSalary(iWorker worker){
double money = worker.salary;
return money;
}
int main(){
iWorker worker;
cout << "Enter salary: ";
cin >> worker.salary;
double salary = calSalary(worker, 0);
cout << salary;
getch();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
和错误:
9: error: new types may not be defined in a return type
9: error: two or more data types in declaration of `calSalary'
In function `iWorker calSalary(iWorker)':
11: error: conversion from `double' to non-scalar type `iWorker' requested
In function `int main()':
9: error: too many arguments to function `iWorker calSalary(iWorker)'
20: error: at this point in file
20: error: cannot convert `iWorker' to `double' in initialization
Run Code Online (Sandbox Code Playgroud)
谢谢 ...
| 归档时间: |
|
| 查看次数: |
1746 次 |
| 最近记录: |