簡體   English   中英

致命錯誤 iostream.h:沒有這樣的文件或目錄 我如何才能擺脫它

[英]FATAL ERROR iostream.h: No such file or directory HOW CAN I GET RİD OF THİS

tempCodeRunnerFile.cpp:1:9: 致命錯誤: iostream.h: 沒有這樣的文件或目錄#include<iostream.h> ^~~~~~~~~~~ ~ 編譯終止。

我寫了這段代碼,但我得到了錯誤。 我怎樣才能擺脫這個。

這是 C++ 中的程序:

#include<iostream.h>

#include<conio.h>

class poly

{

struct node

{

int coeff,deg;

node (lin;

};

node *start,*last;

int size;

public:

poly()

{

start=NULL;

}

void getpoly();

poly operator+(poly);

void display();

};

void poly::getpoly()

{

cout<<"\n\tenter the size:";

cin>>size;

for(int i=1;i<=size;i++)

{

node *temp=new node;

cout<<"\n\tenter the coeffcint:";

cin>>temp->coeff;

cout<<"\n\tenter the degree:";

cin>>temp->deg;

temp->link=NULL;

if(start==NULL)

start=temp;

else

last->link=temp;

last=temp;

}

}

poly poly::operator+(poly p)

{

{

poly temp;

int k=0;

node *i,*j;

i=start;

j=p.start;

while((i!=NULL)&&(j!=NULL))

{

node*t=new node;

t->link=NULL;

if(i->deg==j->deg)

{

k++;

t->coeff=i->coeff+j->coeff;

t->deg=i->deg;

i=j->link;

j=j->link;

}

else if(i->deg>j->deg)

{

t->coeff=i->coeff;

t->deg=i->deg;

i=i->link;

k++;

}

else

{

t->coeff=j->coeff;

t->deg=j->deg;

j=j->link;

k++;

}

if(temp.start==NULL)

temp.start=t;

}

while(i!=NULL)

{

node *t=new node;

t->coeff=i->coeff;

t->deg=i->deg;

t->link=NULL;

temp.last->link=t;

temp.last=t;

i=i->link;

k++;

}

while(j!=NULL)

{

node *t=new node;

t->coeff=j->coeff;

t->deg=j->coeff;

t->link=NULL;

temp.last->link=t;

temp.last=t;

j=j->link;

k++;

}

temp.size=k;

return(temp);

}

void poly::display()

{

for(node *i=start;i!=NULL;i=i->link)

{

if((i->coeff>0)&&(i!=start))

cout<<"+";

cout<<i->coeff<<"X"<<"^"i->deg;

}

}

void main()

{

poly a,b,c;

clrscr();

cout<<"\n\tINPUT";

cout<<"\n\t***";

a.getpoly();

b.getpoly();

c=a+b;

cout<<endl;

cout<<"\n\tOUTPUT";

cout<<"\n\t****";

cout<<"\n\tfirst polynomial:";

a.display();

cout<<endl;

cout<<"\n\tsecond polynomial:";

b.display();

cout<<endl;

cout<<"\n\taddition polynomial:";

c.diplay();

getch();

}

輸入:

輸入尺寸:2

輸入系數:5

進入學位:2

輸入系數:7

進入學位:1

輸入尺寸:2

輸入系數:3

進入學位:2

輸入系數:3

進入學位:1

輸出:

第一個多項式:5X^2+7X^1

第二個多項式:3X^2+3X^1

加法多項式:8x^2+10X^1

改用#include <iostream>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM