프로그램에 문제가있어서 도움을 주시면 감사하겠습니다.C++ 출력 오류
계정 번호, 서비스 코드 및 서비스 사용 시간 (분)을 입력 할 수 있어야합니다. 그러면 프로그램에서 청구서를 계산하며 서비스에 따라 다릅니다. 프로그램을 실행하면 아무 것도 입력 할 수 없습니다.
일반 서비스 : $ 10.00 더하기 처음 50 분 무료입니다. 50 분 이상 요금은 분당 $ 0.20입니다.
프리미엄 서비스 : $ 25.00 플러스 : A) 오후 6 오전 6시 만든 호출의 , 처음 75 분, 무료입니다; 이상의 요금은 분당 $ 0.10입니다. b) 오후 6시에서 오전 6 시까 지 전화를 걸면 처음 100 분이 무료입니다. 100 분이 넘는 비용은 분당 0.05 달러입니다.
다음은 내가 입력 한 프로그램입니다.
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
int minutes = 0,
day_minutes = 0, //minutes used during the day
night_minutes = 0; //minutes used during the night
string service_code,
account_number;
double final_amount,
final_damount, //final amount for day minutes
final_namount = 0; //final amount for night minutes
cout << "Please enter your account number: ";
cin >> account_number;
cout << "Please enter your service code (r or R for regular service and p or P for premium service): ";
cin >> service_code;
if (service_code == "r")
{
cout << "Please enter the amount of minutes used: " << minutes << endl;
}
if (minutes <= 50)
{
final_amount = 10;
cout << "Your final amount is $: " << final_amount << endl;
}
if (minutes > 50)
{
final_amount = (minutes * 0.20) + 10;
cout << "Your final amount is $: " << final_amount << endl;
}
else if (service_code == "p")
{
cout << "Please enter the amount of minutes used during the day: " << day_minutes << endl;
cout << "Please enter the amount of minutes used during the night: " << night_minutes << endl;
}
if (day_minutes <=75)
{
final_damount = 0;
final_amount = final_damount + final_namount + 20;
}
if (day_minutes > 75)
{
final_damount = day_minutes * 0.10;
final_amount = final_damount + final_namount + 20;
}
if (night_minutes <= 100)
{
final_namount = 0;
final_amount = final_damount + final_namount + 20;
}
if (night_minutes > 100)
{
final_namount = night_minutes * 0.05;
final_amount = final_damount + final_namount + 20;
cout << "Your final amount is: $ " << final_amount << endl;
}
else
cout << "Error, this program does not accept negative numbers.\n";
return 0;
}
내 프로그램에 문제가있는 사람이 있습니까? 고맙습니다.
무엇을 시도해 보셨습니까? 무슨 일이야? 디버거를 사용해 보셨습니까? – UpAndAdam
어떤 부분을 정확하게 입력 하시겠습니까? – Biffen
이것은 왜 가장 작은 부분 집합으로 문제를 줄이고 처음에는 질문을하고 적절한 이름을 사용해야하는 큰 이유입니다. – UpAndAdam