私は一般的にC++とプログラミングの新人です。それは読んでいない、他に行くEDIT C++の例を解決して空の出力を得ようとしています
#include <iostream>
#include <string>
using namespace std;
void main()
{
double x, y;
double cost;
char frt;
char Frcr;
char crow;
char R , r, F , f ;
int yes = 0, Yes = 0, No = 0, no = 0;
cout << "Please Enter length and Width of the picture in Inches :\n";
cin >> x >> y;
cout << "Please Enter the Type of the Frame (R/F)(R Stands for Regular ,F Stands for Fancy) : \n";
cin >> frt;
if ('frt' == 'r' || 'frt' == 'R')
{
cost = (x + y)*0.15;
cout << "Do you want to color the frame? (Yes/No) : \n";
cin >> Frcr;
if ('frcr' == yes || 'frcr' == Yes)
{
cost = (x + y)*0.15;
cout << "The Cost is : " << (x + y)*0.15 + ((x + y)*0.10) << endl;
}
else if ('frcr' == no || 'frcr' == No)
{
cost = ((x + y)*0.15);
cout << "The Cost Is : " << cost << endl;
}
}
else
cout << "There is an Error " << endl;
}
場合、私は私はそれにそれを実行し、即座Rそれを置くしようとすると、このプログラムの最初の段階で、このプログラムを書くために
をしようとしています:男の助けを借りての作業コード:)
#include <iostream>
using namespace std;
void main()
{
double x, z;
double cost;
char frt;
char Frcr;
int Crow;
int R, r, F, f;
int y, Y, N, n;
cout << "Please Enter The Width of the picture in Inches :";
cin >> x;
cout << "Please Enter The length of the picture in Inches :";
cin >> z;
cout << "Please Enter the Type of the Frame (R/F):" << endl;
cout << "(R Stands for Regular ,F Stands for Fancy) \n";
cin >> frt;
if (frt == 'r' || frt == 'R')
{
cost = (x + z)*0.15;
cout << "Do you want to color the frame? (Y/N) : \n";
cin >> Frcr;
if (Frcr == 'y' || Frcr == 'Y')
{
cout << "Type The Number Of The Crowns You Want ? :";
cin >> Crow;
cout << "The cost With Frame Coloring : " << ((x + z)*0.15) + ((x + z)*0.10) + (Crow*0.35) << endl;
}
else if (Frcr == 'N' || Frcr == 'n')
{
cout << "Type The Number Of The Crowns You Want ? :";
cin >> Crow;
cout << "The Cost is : " << ((x + z)*0.15) + (Crow*0.35) << endl;
}
else
cout << "Invalid Input." << endl;
}
else if (frt == 'f' || frt == 'F')
{
cout << "Do you want to color the frame? (Y/N) : \n";
cin >> Frcr;
if (Frcr == 'y' || Frcr == 'Y')
{
cout << "Type The Number Of The Crowns You Want ? :";
cin >> Crow;
cout << "The cost With Frame Coloring : " << ((x + z)*0.25) + ((x + z)*0.10) + (Crow*0.35) << endl;
}
else if (Frcr == 'N' || Frcr == 'n')
{
cout << "Type The Number Of The Crowns You Want ? :";
cin >> Crow;
cout << "The Cost is : " << ((x + z)*0.25) + (Crow*0.35) << endl;
}
else
cout << "Invalid Input." << endl;
}
else
cout << "Invalid Input." << endl;
}
と同じではありません場合は私に知らせてくださいこれは、if(「FRT」==「R」 '完全に間違っている|| ' frt == 'R') 'if(frt == 'r' || frt == 'R')'でなければなりません。すべて同じif文に適用されます – DimChtz
ああありがとうございました:D – Bashar
他にもいくつかの問題があります。あなたは、 'F'や' r'のような決して使用しない変数を宣言します。はい/いいえ答えを求めますが、行全体ではなく1文字だけを入力します。 – Barmar