السلام عليكم ورحمة الله وبركاته
ممكن تساعدووني
هذا برنامجي بدأت فيه
بس فيه مشكله في الـ seekg
ماتشتغل عندي ليش؟؟
ايش الخطأ فيها ؟
بليييييييييز ساعدوني
#include<iostream>
#include<fstream>
using namespace std;
struct edges
{
int edgeTo;
edges *next;
};
struct fileData
{
int transNo;
edges *adjs;
fileData *next;
};
int main()
{
fileData data;
data.adjs=NULL;
data.next=NULL;
fileData *p=&data;
char op[10];
int t=0,x=0;
ifstream input;
input.open("input.txt");
if(!input.is_open())
{
cout<<"Cannot open file.\n";
return 1;
}
input>>op;
input>>t;
if(op[0]!='b')
input>>x;
else
data.transNo=t;
cout<<op<<" "<<t<<" "<<x<<".\n";
while(input)
{
input>>op;
input>>t;
if(op[0]!='b')
input>>x;
else
{
p->next=new fileData;
p=p->next;
p->transNo=t;
p->next=NULL;
}
//Checking
cout<<op<<" "<<t<<" "<<x<<".\n";
input.getline(op,20);
}
//Checking
for(p=&data;p!=NULL;p=p->next)
cout<<p->transNo<<"\n";
input.seekg(10,ios::beg);
input>>op;
cout<<op;
input.close();
return 0;
}