从"double"转换为非标量类型请求和其他一些错误

mrd*_*iri 1 c++

请阅读我的代码,并帮我调试它.因为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)

谢谢 ...

sth*_*sth 5

您在; 结构声明后丢失了一个:

struct iWorker{
   ...
};  // <- this one here
Run Code Online (Sandbox Code Playgroud)