#include <string.h>
int main()
{
int gg(int i)
int i
while(1){
i=0
printf(" 1.查看历史日程表\n")
printf(" 2.输入新的日程表\n")
printf(" 3.查看已完成的日程表\n")
printf(" 4.查看未完成的日程表\n")
printf(" 5.退出登录\n")
printf(" 请选择相应序号: ")
scanf("%d",&i)
if(i==5){
break
}
gg(i)
printf("\n")
printf("\n")
printf("\n")
}
}
int gg(int i){
int aa()
int bb()
int cc()
int dd()
switch(i){
case 1:
aa()break
case 2:
bb()break
case 3:
cc()break
case 4:
dd()break
}
}
int aa(){
FILE*fp
int length=1000
char str[1001]
if((fp=fopen("11s.txt","r"))==NULL){
printf("无文件")
return 0
}
while(fgets(str,length,fp)!=NULL){
printf("%s",str)}
return 1
fclose(fp)
}
int bb(){
FILE*fp
char str[400]
printf("内容如下:\n")
scanf("%s",str)
if((fp=fopen("11s.txt","a+"))==NULL){
printf("文件不存在")
return 0
}
fputs("\n",fp)
fputs(str,fp)
printf("加入成功")
fclose(fp)
return 1
}
int cc(){
FILE*fp
int length=1000
char str[1001]
printf("内容如下:\n")
if((fp=fopen("11s.txt","r"))==NULL){
printf("无文件")
return 0
}
while(fgets(str,length,fp)!=NULL){
if(strstr(str,"已完成")!=NULL){
printf("%s",str)
}
}
fclose(fp)
return 1
}
int dd(){
FILE*fp
int lenght=1000
char str[1001]
printf("内容如下:\n")
if((fp=fopen("11s.txt","r"))==NULL){
printf("无文件")
return 0
}
while(fgets(str,lenght,fp)!=NULL){
if(strstr(str,"未完成")!=NULL){
printf("%s",str)
}
}
fclose(fp)
return 1
}
#include <stdio.h>#include <stdlib.h>
#include <malloc.h>
typedef int DataType
typedef struct Node
{
DataType elem
struct Node *top
}StackNode
typedef StackNode *Stack
void Init_Stack(Stack S)
{
S = (Stack)malloc(sizeof(StackNode))
S->top = NULL
}
int Stack_Empty(Stack S)
{
if(S->top == NULL)
{
return 1
}
else
{
return 0
}
}
DataType GetTop(Stack S)
{
if(!Stack_Empty(S))
{
return S->elem
}
else
{
printf("Noting!")
}
return 0
}
void Push(Stack S,DataType elem)
{
Stack NewNode = (Stack)malloc(sizeof(StackNode))
NewNode->elem = elem
NewNode->top = S->top
S->top = NewNode
}
DataType Pop(Stack S)
{
if(Stack_Empty(S) != 1)
{
DataType ch = GetTop(S)
Stack S1 = (S->top)->top
free(S->top)
S = S1
return ch
}
else
{
printf("Noting!")
}
return 0
}
void Conversion(int N,int r)
{
Stack s=NULL
DataType x
Init_Stack(s)
while(N)
{
Push(s,N % r)
N = N / r
}
while(Stack_Empty(s) != 1)
{
x = Pop(s)
printf("%d",x)
}
}
int main()
{
//这里是你的main函数
return 0
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)