Micokery九九 2022-03-24 20:49 采纳率: 91.7%
浏览 17
已结题

请问为什么这里显示这个错误呢


#include<iostream>  
#include<iomanip>
using namespace std;
int main()
{
    cout<<setw(4)<<*<<endl;   error C2059: syntax error : '<<'__
    cout<<setw(3)<<* *<<endl;
    cout<<setw(2)<<*   *<<endl;
    cout<<setw(1)<<*     *<<endl;
    cout<<*********<<endl;
    return 0;
  • 写回答

2条回答 默认 最新

  • 关注

    需要加上引号

    #include <bits/stdc++.h>
    using namespace std;
    
    int main()
    {
        cout<<setw(4)<<"*"<<endl;
        cout<<setw(3)<<"* *"<<endl;
        cout<<setw(2)<<"*   *"<<endl;
        cout<<setw(1)<<"*     *"<<endl;
        cout<<"*********"<<endl;
        return 0;
    }
    

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(1条)

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 3月24日
  • 已采纳回答 3月24日
  • 创建了问题 3月24日