注册 登录
编程论坛 VC++/MFC

syntax error : '<<'

简单做自己 发布于 2015-05-18 21:37, 2062 次点击
#include<iostream>
using namespace std;
class Duoxiangshi{
public:
        int n,i;
        double *a;
        double jg;
        void xg();
        void kb();
        //void shuchu();
        //void jisuan();
        
        void Duoxiangshi::gz(){
            int m;
            int *a = new int[n];
            cout<<"请输入n";
            cout<<"请依次输入系数m";
            for (i=0;i<=n;i++){
                cin>>m;
                a[i] = m;
    }}
        void Duoxiangshi::shuchu(){
            for(i = 0;i<=n;i++){
                cout<<a[i]<<*<<x<<^<<i<<+;}}   想知道这里为什么会出现syntax error : '<<'这个问题
        void Duoxiangshi::jisuan()
            double result;
            double x;
            double s = 0;
            cout<<"请输入x的值";
            cin<<x;
            for(i=0;i<=0;i++)
                s=s+a[i]*x^i;
            cout<<s;}
    };
    double main(){
        Duoxiangshi.gz();
        Duoxiangshi.shuchu();
        Duoxiangshi.jisuan();}
求解决!!!!!!!
2 回复
#2
yangfrancis2015-05-19 17:24
你用*是想输出什么东西?这个符号是有专门意义的,不能随意当变量用吧。如果就是想输出这个符号你得用''关起来,还有你后面的那个加号
#3
yuccn2015-05-19 23:01
代码缩进好不规范啊
1