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");
        }

    }

  • 相关阅读:
    LeetCode Path Sum II
    LeetCode Longest Palindromic Substring
    LeetCode Populating Next Right Pointers in Each Node II
    LeetCode Best Time to Buy and Sell Stock III
    LeetCode Binary Tree Maximum Path Sum
    LeetCode Find Peak Element
    LeetCode Maximum Product Subarray
    LeetCode Intersection of Two Linked Lists
    一天一个设计模式(1)——工厂模式
    PHP迭代器 Iterator
  • 原文地址:https://www.cnblogs.com/ma6174/p/2339245.html
Copyright © 2011-2022 走看看