C 将用户输入从一个函数到另一个功能,并使用Main(Newbie)显示
C++ Carrying user input from one function to another and displaying it with main(newbie)
尝试使用getinput
函数输入用户输入,将其传输到vaidornot
函数,并显示else否则使用MAIN方法屏幕循环,但我无法。我怎样才能做到这一点 ?同样有双重变量的问题吗?:(
#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;
}
您可以更改void getinput(string restname,string name, double point)
到
void getinput(string restname,string name, double& point)
相关文章:
- 链表中的显示功能无法正常工作
- OpenGL Glut显示功能在Mojave上显示黑屏
- 为什么我的显示功能会终止程序?
- 需要帮助操作员过载,这样我才能显示功能
- 氧气显示功能简要概述
- 我的显示功能有问题
- 休息后显示功能
- 由于显示功能而引起的非法间接误差
- 体系结构x86_64的未定义符号-头文件中的显示功能
- 在Visual Studio 08中悬停鼠标时显示功能信息
- 多通道垫子显示功能
- 显示功能不显示数据
- 链表C++,输出未显示在显示功能中
- 单链表显示功能分段故障
- c++ 2d array显示功能
- 优先队列的插入和显示功能
- 从而创建显示功能
- BigInt显示功能
- 显示功能不起作用
- 调试断言失败!在人脸识别打开Cv的检测和显示功能中