视觉C++基本的东西。缺少什么???不可能那么明显
visual C++ basic stuff. What is missing??? Can't be that obvious
谁能帮我理解为什么这个程序继续给我错误?我目前正在使用Visual C++ 2008 Express,并且错误接二连三。我找不到任何明显的东西,但请看一下。
# include "stdafx.h"
# include <iostream>
# include <string>
# include <iomanip>
using namespace std;
int main ()
{
string name;
int age, amountBeer, amountRootBeer;
double beer, rootBeer, taxRate, sum, total, cashTendered, change, tax;
name=“”;
age=amountBeer=amountRootBeer=0;
sum=total=cashTendered=change=tax=0.0;
beer=5.99;
rootBeer=3.99;
taxRate=.07;
cout << “Welcome to BeerMart; where all your beer needs are met. nn”
<< “Please enter your name: “;
getline (cin, name);
cout << “Hello << name << “.n”
<< “Please enter your age: “;
cin >> age;
if (age > 21)
{
cout << “Enter the amount of beers to purchase: “;
cin >> amountBeer;
cout << “Enter the amount of root beers to purchase: “;
cin >> amountRootBeer;
else
cout << “Enter the amount of root beers you want to purchase;
cin >> amountRootBeer;
}
cout << “Please wait while we process your order.”;
sum = (amountBeer * beer) + (amountRootBeer * rootBeer);
tax = sum * taxRate;
total = sum + tax;
system (“pause.exe”);
if (amountBeer > 0 && amountRootBeer > 0)
{
cout << “You ordered “ << amountBeer << “ beer(s) and “ << amountRootBeer<< “ rootBeers.nn”
<< “Beer cost $” << beer << “, and root beers cost $” << rootBeer << “.” << “Your sum is: $“<< sum << “n”
<< “Your tax is: $” << tax << “n”
<< “And your total altogether is; $”<< total << endl;
}
if (amountBeer == 0 && amountRootBeer > 0)
{
cout << “You ordered “ << amountRootBeer<< “ rootBeer(s).nn”
<< “Your sum is: $“<< sum << “n”
<< “Your tax is: $” << tax << “n”
<< “And your total is; $”<< total << endl;
}
if (amountBeer > 0 && amountRootBeer == 0)
{
cout << “You ordered “ << amountBeer << “ beer(s)nn”
<< “Your sum is: $“<< sum << “n”
<< “Your tax is: $” << tax << “n”
<< “And your total is; $”<< total << endl;
}
cout << “Please enter the amount of cash tendered: $”;
cin >> cashTendered;
change = cashTendered - total;
cout << “Your change is; $” << change<< “.nn”
<< “Have a great day!”;
return 0;
}
这是错误...
1>------ Build started: Project: CH5HW Simple Beer sales, Configuration: Debug Win32 ------
1>Compiling...
1>CH5HW Simple Beer sales.cpp
1>c:usersjamesdocumentsvisual studio 2008projectsch5hw simple beer salesch5hw simple beer salesch5hw simple beer sales.cpp(16) : error C2065: 'ìî' : undeclared identifier
这样的例子不胜枚举。
name=“”;
你所有的双引号都不是真正的双引号,看看区别:
name="";
整个代码中也缺少右引号。
cout << “Hello << name << “.n”
if (age > 21)
{
cout << “Enter the amount of beers to purchase: “;
cin >> amountBeer;
cout << “Enter the amount of root beers to purchase: “;
cin >> amountRootBeer;
} //<----you forgot this
else
{ //<--- and this
cout << “Enter the amount of root beers you want to purchase;
cin >> amountRootBeer;
}
相关文章:
- C# HashSet VS C++ std::unordered_set 使用自定义类键。C++慢...不可能。如何实现 C# 的速度?
- 为什么在C++不可能递增或进行数学运算,例如在声明为数组的变量上乘法
- fopen 与常量字符 * 从 QString 是不可能的
- 单元测试不测试什么?
- 矢量返回常量引用,不可能向下转换
- 分配取消引用的字符指针真的不可能吗?
- C#类过程 - 控制C 应用程序,不可能读取输出
- 可能是不可能的模板参数规范/推论
- 易失性结构 = 结构不可能,为什么?
- 在发布模式下崩溃,但如果可调试为 true - 不是..什么是可能的问题
- 矢量超出范围,将值分配给空矢量>不可能?
- 为什么不可能实例化原子对
- 一个倒梯形,但如果输入高度对于宽度来说太大,那么它应该报告,不可能("不可能的形状"是什么)
- W10上不可能使用十字架编译的libpng16-16.dll执行
- 如果明确给出多维数组,为什么不可能char [] [] [] = {..},{..}}
- 为什么我的自定义界面总是返回不可能的0x80040213/VFW_E_NO_CLOCK
- 从张量的读取设备不可能的方法
- 多态性抽象语法树(递归下降解析器):不可能
- 视觉C++基本的东西。缺少什么???不可能那么明显
- 有人可以向我解释什么是"reference reseating",为什么"a reference to point(refer) to another object"不可能?