C about the reading of the file, where did it go wrong

Updated on technology 2024-02-09
6 answers
  1. Anonymous users2024-02-05

    Don't understand what you mean by startmark and enterstumark.

    But wenjian <<"Student ID"<<"\t"<<"Name"<<"\t"<<"Language"<<"\t"<<"Computers"<<"\t"<<"English"<<"\t"<<"Mathematics""There must be a grammatical error in this sentence;

    Because wenjian is opened in read mode, and "is a written operator.

    Only objects of the ofstream class have an operator.

    Got it?

  2. Anonymous users2024-02-04

    ifstream wenjian("Grades. txt");

    Grades. txt",ios::in);Open the file as written.

    Change. ifstream wenjian("Grades. txt");

    Or. ifstream wenjian;

    Grades. txt",ios::in);Open the file as written.

  3. Anonymous users2024-02-03

    Indeed,My opinion is the same as the 2nd floor.,The landlord should be mistaken.,The file object defined with ifstream seems to be only read.,And ofsteam can only write.,I don't understand how the landlord uses it to write and read.。

  4. Anonymous users2024-02-02

    It seems that your program is trying to store the 010110111 number in bianma one by one, and if so, then there are several problems with this program

    Files are opened in a streaming way, which means that the contents of the file depend on your program's interpretation. 010110111 to a program, it's more like a string, you read it by int, int has a range limit, after conversion, it is read as a 1011011, the first 0 is rounded, the following 1 is rounded, and the for loop is actually only read once. So at the very least, your numbers should be separated directly by spaces, i.e. :

    0 1 0 1 1 0 1 1 1 1 then the for loop will be executed 9 times, reading bianma[0] bianma[8].

    The read operation on the stream should generally be while(!).In this way, for is rarely used, because it is generally read to the tail of the stream, which ends naturally. Even if you want to keep counting, it's done in while.

    The processing of files should be read as much as possible by string and line, and then processed, whether it is a conversion or other dump. It's safest that way. So to be unformatted, you should:

    int bianma[500];

    char sline[128] =0";

    ifstream inf("new_");

    if (!inf)

    while (!

  5. Anonymous users2024-02-01

    I would like to ask how this is compiled. x is defined in **.

  6. Anonymous users2024-01-31

    What is the definition of this program, and that number you can see if it is outside the scope of the definition.

Related questions
13 answers2024-02-09

You save the path in an XML and read it out the next time you start it.

6 answers2024-02-09

Understand the following rules: 1) Overloading an operator does not change the priority of the operator. >>>More

11 answers2024-02-09

textreader reader;

int linecount = 0; >>>More

6 answers2024-02-09

First of all, if you are wrong, if the value type is a global or static variable, it is assigned on the heap, and the local variable is allocated on the stack. The reference type is allocated on the heap, because the new comes out of the dynamically allocated memory, so both local and global are in the heap until the garbage user goes to it. In fact, memory allocation is basically the same form, and it has nothing to do with the language.

2 answers2024-02-09

1. Books are best friends. When you encounter any difficulties in life, you can turn to it for help, and it will never turn its back on you. —Dude. >>>More