C++达人进,帮我看下问题出在哪?

来源:百度知道 编辑:UC知道 时间:2024/06/27 13:45:57
程序如下,错误显示为fatal error C1083: Cannot open include file: 'iomainp.h': No such file or directory
帮忙改一下,万分感激!

#include<iostream.h>
#include<iomainp.h>
#include<string.h>
struct data
{
int year;int month;int day;
};
struct friends
{
char name[10];
char sex;
char tel[12];
data birthday;
friends* next;
};
int n;
struct friends* head,*P1,*P2;
n=0;
p1=p2=newfriends;
cout<<"输入我朋友的名字(输入"#"表示结束):"<<endl;
cin>>p1->name;
cout<<"输入我朋友的性别,电话,生日(输入"#"表示结束):"<<endl;
cin>>p1->sex;
cin>>p1->tel;
cin>>p1->birthday.year>>p1->birthday.month>>p1->birthday.day;
head=Null;
while(strcmp(p1->name,"#")!=0)
{
n++;
if(n==1)
head=p1;
else
p2->next=p1;
p2=p1;
p1=n

这个是全部改好的程序,我没有检查逻辑错误,但是所有的语法错误都改了,可以编译通过
我想lz是使用vc6的吧,有一个小建议,就是用
<iostream>替换<iostream.h>
<iomanip>替换<iomanip.h>,还有你这里的头文件名写错了
然后加上using namespace std;这个是标准的c++的stl,是一个好习惯。
程序中最多的错误是NULL,必须全部大写,不能用null(java中的)
也不能用Null
其次是好像有一个create的函数没有写函数头,我猜那个是create,就加上去了
然后还有很多很多的小错误,请lz自己比较着看好啦

#include<iostream>
#include<iomanip>
#include<string.h>
using namespace std;
struct data
{
int year;int month;int day;
};

struct friends
{
char name[10];
char sex;
char tel[12];
data birthday;
friends* next;
};

friends* create()
{

int n;
struct friends *head,*p1,*p2;
n=0;
p1=p2=new friends;
cout<<"输入我朋友的名字(输入\"#\"表示结束):"<<endl;
cin>>p1->name;
cout<<"输入我朋友的性别,电话,生日(输入\"#\"表示结束):"<<endl;