我为用户提供了多种输入选择。我希望用户选择两个选项,我希望将选项存储在num1
和num2
中:
#include<iostream>
using namespace std;
int main()
{
cout<<"This programme will calculate the profit and loss "<<endl;
int num1,num2;
cout<<"What are the given terms "<<'\n'
<<"Please enter any two known terms to find the other remaining unknown terms"<<endl;
cout<<" Cost price:-"<<endl;
cout<<" selling price"<<endl;
cout<<" profit "<<endl;
cout<<"profit percentage "<<endl;
cout<<" loss "<<endl;
cout<<" losspercentage "<<endl;
// i want to store any of the two values in num1 and num2;
}
答案 0 :(得分:0)
要选择两个选项,现在创建num1和num2:
cin>>num1;
cin>>num2;
您可以使用fstream文件并输入
将其存储在文件中 ofstream file;
file.open ("report.txt", ios::app);