-3

trying to take user input with getinput function,transfer it to vaidornot function and display if else loop to screen with main method but i couldnt. How can i do that ? also there is a problem with double variable ? :(

#include <iostream>
#include <string>
using namespace std;

void getinput(string restname, string name, double point) {
    cout << name << "please enter the name of restaurant: " << endl;
    cin >> restname;
    cout << name << "please enter the scores of" << restname << "for first level evolution" << endl;
    cin >> point;
}

void validornot(double point) {
    if (point > 5) {
        cout << "point is bigger than 5" << endl;
    }
    else {
        cout << "point is smaller than 5" << endl;
    }
}

int main() {
    string name;
    string restname;
    double point;

    cout << "Welcome to my restaurant rating programme.Please enter your name to start:" << endl;
    cin >> name;
    cout << "Welcome " << name << endl;
    getinput(restname, name, point);
    validornot(point);

    return 0;
}
General Grievance
  • 4,555
  • 31
  • 31
  • 45

1 Answers1

1

You can change void getinput(string restname,string name, double point) to

void getinput(string restname,string name, double& point)
JLev
  • 705
  • 1
  • 9
  • 30