C++ 分号/字符串常量错误

C++ 分号/字符串常量错误,c++,C++,好了,伙计们,我的问题很简单 当我试图构建这段代码时,在第45行和第55行中出现了两个错误,它们都是错误:预期的;在字符串常量之前。 为了澄清,第45行和第55行在最后一节案例3和案例4中一直向下,我在行前面放了星星,以明确我的意思!没有字符串常量,所以我很困惑。请帮忙 #include <iostream> <cmath> using namespace std; int main() { bool goOn; do { go

好了,伙计们,我的问题很简单 当我试图构建这段代码时,在第45行和第55行中出现了两个错误,它们都是错误:预期的;在字符串常量之前。 为了澄清,第45行和第55行在最后一节案例3和案例4中一直向下,我在行前面放了星星,以明确我的意思!没有字符串常量,所以我很困惑。请帮忙

#include <iostream> <cmath>

using namespace std;

int main()
{
    bool goOn;
    do
    {
        goOn = false;
        cout <<"Press 1 to add" <<endl;
        cout <<"Press 2 to subtract" <<endl;
        cout <<"Press 3 to multiply" <<endl;
        cout <<"Press 4 to divide" <<endl;
        cout <<"Pres 5 to end the program" <<endl;
        int num;
            cin >>num;
            switch (num)
            {
                case 1: //adding
                    int sum;
                    int add1;
                    int add2;
                        cout <<"What do you want to add? Type 2 Numbers!" <<endl;
                        cin >>add1 >>add2;
                        sum = add1+add2;
                        cout <<"Sum is:" <<sum <<endl;
                break;
                case 2: //subtracting
                    int dif;
                    int sub1;
                    int sub2;
                        cout <<"What do you want to subtract? Type 2 Numbers!" <<endl;
                        cin >>sub1 >>sub2;
                        dif = sub1-sub2;
                        cout <<"Difference is" <<dif <<endl;
                break;
                case 3: //multiplying
                    int prod;
                    int fac1;
                    int fac2;
                        cout <<"What do you want to multiply?" <<endl;
                        cin >>fac1 >>fac2;
                        prod = fac1*fac2;
                        **cout <<"Done!" <<fac1 " multiplied by " <<fac2 " equals " <<prod <<endl;
                case 4: //dividing
                    int quot;
                    int divid;
                    int divis;
                    int rem;
                        cout <<"What do you want to divide, and with what? Dividend first, then divisor!" <<endl;
                        cin >>divid >>divis;
                        quot = divid/divis;
                        rem = divid%divis;
                        **cout <<"Done!" <<divid " divided by " <<divis " equals " <<quot " with a remainder of " <<rem <<endl;
                break;
                case 5: //ending the program
                    cout <<"Goodbye" <<endl;
                return 0;
                default:
                    cout <<"Bad input" <<endl;
                break;
            }
        } while (goOn == false);
}
#包括
使用名称空间std;
int main()
{
布尔贡;
做
{
傻瓜=假;

“我有两个错误”是吗?请编辑你的问题,把所有的信息都包括进去。也许如果你看一下这行,编译器告诉你的地方,你会看到你忘记输入了什么?顺便说一句,
“乘以”
是一个字符串常量。非常感谢!我不知道你需要输入
cout <<"Done!" <<fac1  " multiplied by " <<fac2 " equals " <<prod <<endl;
cout <<"Done!" <<fac1 << " multiplied by " <<fac2 <<" equals " <<prod <<endl;
cout <<"Done!" <<divid " divided by " <<divis " equals " <<quot " with a remainder of " <<rem <<endl;
cout <<"Done!" <<divid << " divided by " <<divis << " equals " <<quot <<" with a remainder of " <<rem <<endl;