小编tp7*_*p77的帖子

C++从文件末尾向后读取文件

我正在尝试编写一个带有菜单的程序,该菜单可以通过几种不同的方式从文本文件中读取.我只是在处理菜单选项#2(从文件末尾向后读),但我无法理解我做错了什么.我已经在这几天了,而且找不到任何好的资源来帮助解决这个问题.任何帮助,将不胜感激.

#include <iostream>
#include <string>
#include <iomanip>
#include <istream>
#include <math.h>
#include <fstream>

using namespace std;

const int SIZE = 20;                     
typedef char String[SIZE];

//prototypes
void Menu(int &);
void ReadFile(ifstream &);
void BackwardFile(ifstream &,long &);
long CountFile(ifstream &,long &);

int main()
{  
    char filename[]= "grades.txt";
    int choice;
    long numBytes;

    ifstream InList;
    InList.open(filename);

    if(InList.good())
    {
        do
        {         
            Menu(choice); 
            switch(choice)
            {
                case 1:  
                    ReadFile(InList);
                    break;
                case 2:
                    CountFile(InList,numBytes);
                    BackwardFile(InList,numBytes);
                    break;
                case 3:
                    cout << "Pick a start position between 0 - " …
Run Code Online (Sandbox Code Playgroud)

c++ eof seekg

4
推荐指数
2
解决办法
1万
查看次数

div 不允许作为按钮的子元素

我已经阅读了有关此的几个主题,但仍然不明白有效的替代方案。从视觉上看,它看起来就像我想要的那样,但我收到验证错误,并且我不知道如何更改它。这是我正在使用的一个简单版本:

<button type="submit" onclick="window.location.href='events.html'">
    <div id="box1" class="eventContainer">
    <h3>CLICK ON ME!</h3>
    <p>Description</p>
    <img>
    </div>
</button> 
Run Code Online (Sandbox Code Playgroud)

html

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

c++ ×1

eof ×1

html ×1

seekg ×1