zoukankan      html  css  js  c++  java
  • 在文本文档中查找数据的应用C语言+dos

     目的是搜索一个名称是否在文档中存在,存在的话显示出来。不是完全用C语言,结合一点批处理技术,实现起来比较简单

    #include<stdio.h>
    #include<stdlib.h>
    #include<windows.h>
    #include<conio.h>
    #include<string.h>
    int main()
    {
        char string_to_be_find[100];
        while(true)
        {
            char find[100]="find /I d:\\查找题目专用文档--随时更新--ma6174.txt \"";
            printf("\t\t题目查找专用程序   BY ma6174\n\n");
            printf("请输入要查找的题目名:");
            gets(string_to_be_find);
            if(strlen(string_to_be_find)==0)
            {
                system("cls");
                continue;
            }
            strcat(find,string_to_be_find);
            strcat(find,"\"");
            system(find);
            printf("是否将题目名加入文档?(y/n)");
            char choice=getche();
            if(choice=='y'||choice=='Y')
            {
                char write_in_file[100]="echo ";
                strcat(write_in_file,string_to_be_find);
                strcat(write_in_file," >>d:\\查找题目专用文档--随时更新--ma6174.txt");
                system(write_in_file);
                printf("\n\n题目名已经写入!");
                Sleep(2000);
            }
            system("cls");
        }

    }

  • 相关阅读:
    20191330雷清逸 学习笔记4
    sort
    20191330雷清逸 MyOD(选作,计入平时成绩)
    20191330雷清逸 Linux C语言编程基础(必做)
    20191330雷清逸 学习笔记3
    20191330雷清逸 学习笔记2
    无限的技能
    20191330 雷清逸 学习笔记1
    2021-2022-1-diocs-Linux系统编程第四周学习笔记
    Linux下man命令的使用
  • 原文地址:https://www.cnblogs.com/ma6174/p/2339245.html
Copyright © 2011-2022 走看看