Home > Back-end >  , ladies and gentlemen, this is the part of the code I wrote, but in the heart of the readfile TXT t
, ladies and gentlemen, this is the part of the code I wrote, but in the heart of the readfile TXT t

Time:12-09

#include
#include
#include
#include
using namespace std;
Struct node
{string data.
The string word;
The string sign;
//the string name; Struct node * next;
};
//set up by the head pointer has n nodes linked list, head for the reference parameters,
//in order to make the argument for the corresponding list header pointer
Void creat (node * & amp; The head, int n)
{if (n & lt; 0 {cout & lt; <"The value of n is invalid" & lt; cin> x;
cout<" Enter a character "& lt; cin> W1.
cout<" Enter a character "& lt; cin> W2.
cout word=w1; P -> sign=w2;//data area modified p -> next=NULL; If (n==1) return; For (I=1; I <=n - 1; I++) {p=new node; Last -> next=p; Cout <"enter a digital" & lt; x; cout<" Enter a character "& lt; W1. cout<" Enter a character "& lt; W2. cout word=w1; P -> sign=w2;//data area modified last=p; } p -> next=NULL;
}

Void the save (node * & amp; Head)//function name is the modified
{
Node * p; Ofstream file (" yourinfo. TXT ", the ios: : app);//open the file file & lt; }

Void readfile ()//read data in a file
{
Rear head node * and * and * G;
The head=new node;
G=new node;
Rear=head;
Ifstream read (" yourinfo. TXT ");
if(! Read)
{
cout<" Failed to read file!!!!! "& lt; system("pause");
The exit (1);
}
While (read> Setw (10) & gt;> G - & gt; Data> Setw (10) & gt;> G - & gt; Word> Setw (10) & gt;> G - & gt; Sign)
{
G=new node;
Rear - & gt; Next=G;
Rear=G;
Read> Setw (10) & gt;> G - & gt; Data> Setw (10) & gt;> G - & gt; Word> Setw (10) & gt;> G - & gt; Sign;
}
Rear - & gt; Next=NULL;
Read. The close ();
}
Int main ()
{cout & lt; <"Need how many sets of data storage & lt;" n; Creat (head, n); Cout & lt; }

CodePudding user response:

Read and write need one to one correspondence

CodePudding user response:

reference 1/f, Simple, Soft reply:
need to read and write one to one correspondence
beginner c + + can you please detailed guidance

CodePudding user response:

reference 1/f, Simple, Soft reply:
need to read and write one to one correspondence
beginner c + + can you guidance

CodePudding user response:

You have to describe what your problem is

CodePudding user response:

refer to 4th floor, Simple, Soft reply:
you have to describe what your problem is
is my readfile when reading data files have any error