-1
我正在創建iventory管理系統,但會發生什麼是 我輸入的數據不會進入文件,也不會編譯。我想知道什麼 與我的代碼完全錯誤。文件處理C++
之所以我補充說缺席的日期數是從基本薪水中扣除它。提前感謝。 這是我的計劃
void input()
{
ofstream empfile;
empfile.open("emp.txt",ios :: app);
cout << "Enter the National Identity Card Number of the Employer \n";
cin >>nic;
cout << "Enter the first name of the Employer \n";
cin >>firstName;
cout <<"Enter the last name of the Employer \n";
cin >>lastName;
cout << "Enter the date of birth [date/month/year] \n";
cin >> dob;
cout <<"Enter your Telephone Number \n";
cin>> pnum;
cout <<"Enter your address \n";
cin >> address;
cout <<"Your daily basic Salary is Rs20000 \n";
cout << "How many days did she/he haven't reported to the Factory? \n";
cin >>days;
if(days=1)
{
salary=salary-1000;
}
else if(days<3 && days>1)
{
salary=salary+2000;
}
else if(days>=3)
{
salary=salary-3000;
}
else
{
cout << "Please enter a valid number of days \n";
}
empfile >> nic >> ' ' >>firstName >> ' ' >> lastName >> ' ' >> dob >> ' ' >>pnum>> ' ' >>address >> ' ' >> salary>> endl;
empfile.close();
}
這不會給你一個編譯錯誤? –
是的,這就是問題 – YoLa
我很好奇你爲什麼決定在你的問題中聲稱一些其他症狀。 –