/*Header.h file*/
#include <iostream>
using namespace std;
int main(){
/*Menu*/
/*case1:
int x;
cout << "Input ammount:";
cin >> x
sugarcake(x)*/
/*case2:
something else
*/
}
/*sugarcake.cpp file*/
#include <iostream>
#include "Header.h"
using namespace std;
void sugarcake(int x) {
cout << (x * 0.75) << "st egg" << endl;
cout << (x * 0.75) << "dl sugar" << endl;
cout << (x * 0.5) << "tsk vanillasugar" << endl;
cout << (x * 0.5) << "tsk blabla" << endl;
cout << (x * 0.75) << "dl wheatflour" << endl;
cout << (x * 18.75) << "gram butter" << endl;
cout << (x * 0.25) << "dl water" << endl;
}
我应该如何让它工作,或者我完全误解了吗?(昨天刚开始学习C++,所以请友善一些,我还没有能够在其他地方找到适合我的清晰答案)
简短版:在Header.h中调用sugarcake.cpp中的sugarcake(int x)函数。