Compiler Not Recognizing Function Calls



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
using namespace std;
void input(int& feet, int& inches);
void chopin(int& feet, int& inches, int& meters, double& centimeters);
void output(double& meters, double& centimeters);
int main()
{
    
    double centimeters, feet, inches, meters;
start:
    input(feet, inches); // No matching function for call to 'input'
    chopin(feet, inches, meters, centimeters); // No matching function for call to 'chopin' 
    output(meters, centimeters);
    cout << endl;
    goto start;
    
    return 0;
}

void input(int& feet, int& inches)
{
    cout << "Input the feet and inches." << endl;
    cin >> feet >> inches;
}

void chopin(int& feet, int& inches, int& meters, double& centimeters)
{
    meters = (0.3048 * feet) + ((12 * inches) * 0.3048);
    centimeters = meters * 100;
}

void output(double& meters, double& centimeters)
{
    cout << meters << " meters" << endl << centimeters << " centimeters";
}
Maybe this message would be clearer
foo.cpp: In function ‘int main()’:
foo.cpp:11:20: error: invalid initialization of reference of type ‘int&’ from expression of type ‘double’
foo.cpp:3:6: error: in passing argument 1 of ‘void input(int&, int&)’
foo.cpp:12:42: error: invalid initialization of reference of type ‘int&’ from expression of type ‘double’
foo.cpp:4:6: error: in passing argument 1 of ‘void chopin(int&, int&, int&, double&)’
Topic archived. No new replies allowed.