eventDelete Editor

//----------------------------------------------
//            NGUI: Next-Gen UI kit
// Copyright © 2011-2014 Tasharen Entertainment
//----------------------------------------------

#if UNITY_EDITOR || (!UNITY_FLASH && !NETFX_CORE)
#define REFLECTION_SUPPORT
#endif

#if REFLECTION_SUPPORT
using System.Reflection;
#endif

using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// Delegate callback that Unity can serialize and set via Inspector.
/// </summary>

[System.Serializable]
public class EventDelegate
{
	[SerializeField] MonoBehaviour mTarget;
	[SerializeField] string mMethodName;

	/// <summary>
	/// Whether the event delegate will be removed after execution.
	/// </summary>

	public bool oneShot = false;

	public delegate void Callback();
	Callback mCachedCallback;
	bool mRawDelegate = false;

	/// <summary>
	/// Event delegate's target object.
	/// </summary>

	public MonoBehaviour target { get { return mTarget; } set { mTarget = value; mCachedCallback = null; mRawDelegate = false; } }

	/// <summary>
	/// Event delegate's method name.
	/// </summary>

	public string methodName { get { return mMethodName; } set { mMethodName = value; mCachedCallback = null; mRawDelegate = false; } }

	/// <summary>
	/// Whether this delegate's values have been set.
	/// </summary>

	public bool isValid { get { return (mRawDelegate && mCachedCallback != null) || (mTarget != null && !string.IsNullOrEmpty(mMethodName)); } }

	/// <summary>
	/// Whether the target script is actually enabled.
	/// </summary>

	public bool isEnabled { get { return (mRawDelegate && mCachedCallback != null) || (mTarget != null && mTarget.enabled); } }

	public EventDelegate () { }
	public EventDelegate (Callback call) { Set(call); }
	public EventDelegate (MonoBehaviour target, string methodName) { Set(target, methodName); }

	/// <summary>
	/// GetMethodName is not supported on some platforms.
	/// </summary>

#if REFLECTION_SUPPORT
	#if !UNITY_EDITOR && UNITY_WP8
		static string GetMethodName (Callback callback)
		{
			System.Delegate d = callback as System.Delegate;
			return d.Method.Name;
		}

		static bool IsValid (Callback callback)
		{
			System.Delegate d = callback as System.Delegate;
			return d != null && d.Method != null;
		}
	#elif !UNITY_EDITOR && UNITY_METRO
		static string GetMethodName (Callback callback)
		{
			System.Delegate d = callback as System.Delegate;
			return d.GetMethodInfo().Name;
		}

		static bool IsValid (Callback callback)
		{
			System.Delegate d = callback as System.Delegate;
			return d != null && d.GetMethodInfo() != null;
		}
	#else
		static string GetMethodName (Callback callback) { return callback.Method.Name; }
		static bool IsValid (Callback callback) { return callback != null && callback.Method != null; }
	#endif
#else
	static bool IsValid (Callback callback) { return callback != null; }
#endif

	/// <summary>
	/// Equality operator.
	/// </summary>

	public override bool Equals (object obj)
	{
		if (obj == null)
		{
			return !isValid;
		}

		if (obj is Callback)
		{
			Callback callback = obj as Callback;
#if REFLECTION_SUPPORT
			if (callback.Equals(mCachedCallback)) return true;
			MonoBehaviour mb = callback.Target as MonoBehaviour;
			return (mTarget == mb && string.Equals(mMethodName, GetMethodName(callback)));
#elif UNITY_FLASH
			return (callback == mCachedCallback);
#else
			return callback.Equals(mCachedCallback);
#endif
		}
		
		if (obj is EventDelegate)
		{
			EventDelegate del = obj as EventDelegate;
			return (mTarget == del.mTarget && string.Equals(mMethodName, del.mMethodName));
		}
		return false;
	}

	static int s_Hash = "EventDelegate".GetHashCode();

	/// <summary>
	/// Used in equality operators.
	/// </summary>

	public override int GetHashCode () { return s_Hash; }

	/// <summary>
	/// Convert the saved target and method name into an actual delegate.
	/// </summary>

	Callback Get ()
	{
#if REFLECTION_SUPPORT
		if (!mRawDelegate && (mCachedCallback == null || (mCachedCallback.Target as MonoBehaviour) != mTarget || GetMethodName(mCachedCallback) != mMethodName))
		{
			if (mTarget != null && !string.IsNullOrEmpty(mMethodName))
			{
				mCachedCallback = (Callback)System.Delegate.CreateDelegate(typeof(Callback), mTarget, mMethodName);
			}
			else return null;
		}
#endif
		return mCachedCallback;
	}

	/// <summary>
	/// Set the delegate callback directly.
	/// </summary>

	void Set (Callback call)
	{
		if (call == null || !IsValid(call))
		{
			mTarget = null;
			mMethodName = null;
			mCachedCallback = null;
			mRawDelegate = false;
		}
		else
		{
#if REFLECTION_SUPPORT
			mTarget = call.Target as MonoBehaviour;

			if (mTarget == null)
			{
				mRawDelegate = true;
				mCachedCallback = call;
				mMethodName = null;
			}
			else
			{
				mMethodName = GetMethodName(call);
				mRawDelegate = false;
			}
#else
			mRawDelegate = true;
			mCachedCallback = call;
			mMethodName = null;
			mTarget = null;
#endif
		}
	}

	/// <summary>
	/// Set the delegate callback using the target and method names.
	/// </summary>

	public void Set (MonoBehaviour target, string methodName)
	{
		this.mTarget = target;
		this.mMethodName = methodName;
		mCachedCallback = null;
		mRawDelegate = false;
	}

	/// <summary>
	/// Execute the delegate, if possible.
	/// This will only be used when the application is playing in order to prevent unintentional state changes.
	/// </summary>

	public bool Execute ()
	{
		Callback call = Get();

		if (call != null)
		{
#if UNITY_EDITOR
			if (Application.isPlaying)
			{
				call();
			}
			else if (call.Target != null)
			{
				System.Type type = call.Target.GetType();
				object[] objs = type.GetCustomAttributes(typeof(ExecuteInEditMode), true);
				if (objs != null && objs.Length > 0) call();
			}
#else
			call();
#endif
			return true;
		}
#if !REFLECTION_SUPPORT
		if (isValid)
		{
			mTarget.SendMessage(mMethodName, SendMessageOptions.DontRequireReceiver);
			return true;
		}
#endif
		return false;
	}

	/// <summary>
	/// Clear the event delegate.
	/// </summary>

	public void Clear ()
	{
		mTarget = null;
		mMethodName = null;
		mRawDelegate = false;
		mCachedCallback = null;
	}

	/// <summary>
	/// Convert the delegate to its string representation.
	/// </summary>

	public override string ToString ()
	{
		if (mTarget != null)
		{
			string typeName = mTarget.GetType().ToString();
			int period = typeName.LastIndexOf('.');
			if (period > 0) typeName = typeName.Substring(period + 1);

			if (!string.IsNullOrEmpty(methodName)) return typeName + "." + methodName;
			else return typeName + ".[delegate]";
		}
		return mRawDelegate ? "[delegate]" : null;
	}

	/// <summary>
	/// Execute an entire list of delegates.
	/// </summary>

	static public void Execute (List<EventDelegate> list)
	{
		if (list != null)
		{
			for (int i = 0; i < list.Count; )
			{
				EventDelegate del = list[i];

				if (del != null)
				{
					del.Execute();

					if (del.oneShot)
					{
						list.RemoveAt(i);
						continue;
					}
				}
				++i;
			}
		}
	}

	/// <summary>
	/// Convenience function to check if the specified list of delegates can be executed.
	/// </summary>

	static public bool IsValid (List<EventDelegate> list)
	{
		if (list != null)
		{
			for (int i = 0, imax = list.Count; i < imax; ++i)
			{
				EventDelegate del = list[i];
				if (del != null && del.isValid)
					return true;
			}
		}
		return false;
	}

	/// <summary>
	/// Assign a new event delegate.
	/// </summary>

	static public void Set (List<EventDelegate> list, Callback callback)
	{
		if (list != null)
		{
			list.Clear();
			list.Add(new EventDelegate(callback));
		}
	}

	/// <summary>
	/// Append a new event delegate to the list.
	/// </summary>

	static public void Add (List<EventDelegate> list, Callback callback) { Add(list, callback, false); }

	/// <summary>
	/// Append a new event delegate to the list.
	/// </summary>

	static public void Add (List<EventDelegate> list, Callback callback, bool oneShot)
	{
		if (list != null)
		{
			for (int i = 0, imax = list.Count; i < imax; ++i)
			{
				EventDelegate del = list[i];
				if (del != null && del.Equals(callback))
					return;
			}

			EventDelegate ed = new EventDelegate(callback);
			ed.oneShot = oneShot;
			list.Add(ed);
		}
		else
		{
			Debug.LogWarning("Attempting to add a callback to a list that's null");
		}
	}

	/// <summary>
	/// Append a new event delegate to the list.
	/// </summary>

	static public void Add (List<EventDelegate> list, EventDelegate ev) { Add(list, ev, false); }

	/// <summary>
	/// Append a new event delegate to the list.
	/// </summary>

	static public void Add (List<EventDelegate> list, EventDelegate ev, bool oneShot)
	{
		if (list != null)
		{
			for (int i = 0, imax = list.Count; i < imax; ++i)
			{
				EventDelegate del = list[i];
				if (del != null && del.Equals(ev))
					return;
			}
			
			EventDelegate ed = new EventDelegate(ev.target, ev.methodName);
			ed.oneShot = oneShot;
			list.Add(ed);
		}
		else
		{
			Debug.LogWarning("Attempting to add a callback to a list that's null");
		}
	}

	/// <summary>
	/// Remove an existing event delegate from the list.
	/// </summary>

	static public bool Remove (List<EventDelegate> list, Callback callback)
	{
		if (list != null)
		{
			for (int i = 0, imax = list.Count; i < imax; ++i)
			{
				EventDelegate del = list[i];
				
				if (del != null && del.Equals(callback))
				{
					list.RemoveAt(i);
					return true;
				}
			}
		}
		return false;
	}
}


//----------------------------------------------
//            NGUI: Next-Gen UI kit
// Copyright © 2011-2014 Tasharen Entertainment
//----------------------------------------------

using UnityEngine;
using UnityEditor;
using System.Reflection;
using System.Collections.Generic;

public static class EventDelegateEditor
{
	class Entry
	{
		public MonoBehaviour target;
		public MethodInfo method;
	}

	/// <summary>
	/// Collect a list of usable delegates from the specified target game object.
	/// The delegates must be of type "void Delegate()".
	/// </summary>

	static List<Entry> GetMethods (GameObject target)
	{
		MonoBehaviour[] comps = target.GetComponents<MonoBehaviour>();

		List<Entry> list = new List<Entry>();

		for (int i = 0, imax = comps.Length; i < imax; ++i)
		{
			MonoBehaviour mb = comps[i];
			if (mb == null) continue;

			MethodInfo[] methods = mb.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public);

			for (int b = 0; b < methods.Length; ++b)
			{
				MethodInfo mi = methods[b];

				if (mi.GetParameters().Length == 0 && mi.ReturnType == typeof(void))
				{
					if (mi.Name != "StopAllCoroutines" && mi.Name != "CancelInvoke")
					{
						Entry ent = new Entry();
						ent.target = mb;
						ent.method = mi;
						list.Add(ent);
					}
				}
			}
		}
		return list;
	}

	/// <summary>
	/// Convert the specified list of delegate entries into a string array.
	/// </summary>

	static string[] GetMethodNames (List<Entry> list, string choice, out int index)
	{
		index = 0;
		string[] names = new string[list.Count + 1];
		names[0] = string.IsNullOrEmpty(choice) ? "<Choose>" : choice;

		for (int i = 0; i < list.Count; )
		{
			Entry ent = list[i];
			string type = ent.target.GetType().ToString();
			int period = type.LastIndexOf('.');
			if (period > 0) type = type.Substring(period + 1);

			string del = type + "." + ent.method.Name;
			names[++i] = del;
			
			if (index == 0 && string.Equals(del, choice))
				index = i;
		}
		return names;
	}

	/// <summary>
	/// Draw an editor field for the Unity Delegate.
	/// </summary>

	static public bool Field (Object undoObject, EventDelegate del)
	{
		return Field(undoObject, del, true);
	}

	/// <summary>
	/// Draw an editor field for the Unity Delegate.
	/// </summary>

	static public bool Field (Object undoObject, EventDelegate del, bool removeButton)
	{
		if (del == null) return false;
		bool prev = GUI.changed;
		GUI.changed = false;
		bool retVal = false;
		MonoBehaviour target = del.target;
		bool remove = false;

		if (removeButton && (del.target != null || del.isValid))
		{
			if (del.target == null && del.isValid)
			{
				EditorGUILayout.LabelField("Notify", del.ToString());
			}
			else
			{
				target = EditorGUILayout.ObjectField("Notify", del.target, typeof(MonoBehaviour), true) as MonoBehaviour;
			}

			GUILayout.Space(-20f);
			GUILayout.BeginHorizontal();
			GUILayout.Space(64f);

#if UNITY_3_5
			if (GUILayout.Button("X", GUILayout.Width(20f)))
#else
			if (GUILayout.Button("", "ToggleMixed", GUILayout.Width(20f)))
#endif
			{
				target = null;
				remove = true;
			}
			GUILayout.EndHorizontal();
		}
		else
		{
			target = EditorGUILayout.ObjectField("Notify", del.target, typeof(MonoBehaviour), true) as MonoBehaviour;
		}

		if (remove)
		{
			NGUIEditorTools.RegisterUndo("Delegate Selection", undoObject);
			del.Clear();
			EditorUtility.SetDirty(undoObject);
		}
		else if (del.target != target)
		{
			NGUIEditorTools.RegisterUndo("Delegate Selection", undoObject);
			del.target = target;
			EditorUtility.SetDirty(undoObject);
		}

		if (del.target != null && del.target.gameObject != null)
		{
			GameObject go = del.target.gameObject;
			List<Entry> list = GetMethods(go);

			int index = 0;
			string[] names = GetMethodNames(list, del.ToString(), out index);
			int choice = 0;

			GUILayout.BeginHorizontal();
			choice = EditorGUILayout.Popup("Method", index, names);
			GUILayout.Space(18f);
			GUILayout.EndHorizontal();

			if (choice > 0)
			{
				if (choice != index)
				{
					Entry entry = list[choice - 1];
					NGUIEditorTools.RegisterUndo("Delegate Selection", undoObject);
					del.target = entry.target;
					del.methodName = entry.method.Name;
					EditorUtility.SetDirty(undoObject);
					GUI.changed = prev;
					return true;
				}
			}
		}

		retVal = GUI.changed;
		GUI.changed = prev;
		return retVal;
	}

	/// <summary>
	/// Draw a list of fields for the specified list of delegates.
	/// </summary>

	static public void Field (Object undoObject, List<EventDelegate> list)
	{
		Field(undoObject, list, null, null);
	}

	/// <summary>
	/// Draw a list of fields for the specified list of delegates.
	/// </summary>

	static public void Field (Object undoObject, List<EventDelegate> list, string noTarget, string notValid)
	{
		bool targetPresent = false;
		bool isValid = false;

		// Draw existing delegates
		for (int i = 0; i < list.Count; )
		{
			EventDelegate del = list[i];

			if (del == null || (del.target == null && !del.isValid))
			{
				list.RemoveAt(i);
				continue;
			}

			Field(undoObject, del);
			EditorGUILayout.Space();

			if (del.target == null && !del.isValid)
			{
				list.RemoveAt(i);
				continue;
			}
			else
			{
				if (del.target != null) targetPresent = true;
				isValid = true;
			}
			++i;
		}

		// Draw a new delegate
		EventDelegate newDel = new EventDelegate();
		Field(undoObject, newDel);

		if (newDel.target != null)
		{
			targetPresent = true;
			list.Add(newDel);
		}

		if (!targetPresent)
		{
			if (!string.IsNullOrEmpty(noTarget))
			{
				GUILayout.Space(6f);
				EditorGUILayout.HelpBox(noTarget, MessageType.Info, true);
				GUILayout.Space(6f);
			}
		}
		else if (!isValid)
		{
			if (!string.IsNullOrEmpty(notValid))
			{
				GUILayout.Space(6f);
				EditorGUILayout.HelpBox(notValid, MessageType.Warning, true);
				GUILayout.Space(6f);
			}
		}
	}
}


#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #define CONTENT_LENGTH 100 typedef struct event{ int year; int month; int day; int hour; int minute; char content[CONTENT_LENGTH]; struct event *next; }Event; //初始化链表 Event* init(){ Event *eHead = (Event*)malloc(sizeof(Event)); eHead->next=NULL; if(eHead!=NULL){ return eHead; } else{ printf("空间分配失败!"); exit(1); } } //打印事件具体时间 void printInfo(Event *Ev){ printf("日期: %04d/%02d/%02d 时间: %02d:%02d 事件:%s\n",Ev->year,Ev->month,Ev->day,Ev->hour,Ev->minute,Ev->content); } //输入新的事件 总是从尾端插入 Event* insert(Event *eHead){ for(;eHead->next!=NULL;eHead=eHead->next); Event *test=(Event*)malloc(sizeof(Event)); test->next=NULL; printf("请输入日期:yyyy/mm/dd(例如:2025/04/23)\n"); scanf("%d %*c %d %*c %d",&test->year,&test->month,&test->day); printf("请输入具体时间:hh:MM(例如:04:23)\n"); scanf("%d %*c %d",&test->hour,&test->minute); fflush(stdin); printf("请输入事件内容(最长为50个字符):\n"); gets(test->content); printf("事件已成功保存!\n"); eHead->next=test; } //比较两事件的时间先后 int compare(Event *a,Event *b){ //将Int格式化为str,直接比较字符串的大小 char str_a[100]={0}; sprintf(str_a,"%d04%02d%02d%02d%02d",a->year,a->month,a->day,a->hour,a->minute); char str_b[100]={0}; sprintf(str_b,"%d04%02d%02d%02d%02d",b->year,b->month,b->day,b->hour,b->minute); int n=strcmp(str_a,str_b); if(n>0){ return 1; } else{ return 0; } } //排序 Event* sort(Event *L){ Event *p, *q, *next; int temp; for( p = L->next; p->next != NULL; p = p->next ) /*每次循环都找出一个最小值,将最小值交换到第一位,然后将指针向后移动一位*/ { next = p; for( q = p->next; q; q = q->next ) /*由前向后遍历,找出最小的节点*/ { if( compare(next,q)==1 ) next = q; } if( next != p ) { temp = p->year; p->year = next->year; next->year = temp; temp = p->month; p->month = next->month; next->month = temp; temp = p->day; p->day = next->day; next->day = temp; temp = p->hour; p->hour = next->hour; next->hour = temp; temp = p->minute; p->minute = next->minute; next->minute = temp; char tem[CONTENT_LENGTH]; memcpy(tem,p->content,100); memcpy(p->content,next->content,100); memcpy(next->content,tem,100); } } printf("排序成功!\n"); return L; } // 通过具体日期查找事件 void findByDate(Event *head) { int year, month, day; printf("请输入日期:yyyy/mm/dd(例如:2025/04/23)\n"); if (scanf("%d/%d/%d", &year, &month, &day) != 3) { printf("日期格式错误!\n"); while (getchar() != '\n'); // 清空缓冲区 return; } printf("查找中...\n"); Event *current = head; // 假设链表无头节点,否则改为 head->next int found = 0; for (; current != NULL; current = current->next) { if (current->year == year && current->month == month && current->day == day) { printf("已找到:\n"); printInfo(current); found = 1; break; } } if (!found) { printf("未找到该事件\n"); } } //通过事件内容查找事件 void findByEventContent(Event *head) { char temp[CONTENT_LENGTH]; printf("请输入要查找的事件内容: "); fgets(temp, sizeof(temp), stdin); temp[strcspn(temp, "\n")] = '\0'; // 去除换行符 printf("正在查找...n"); Event *current = head; int found = 0; while(current != NULL) { if(strcmp(temp, current->content) == 0) { printf("找到匹配事件:n"); printInfo(current); found = 1; break; } current = current->next; } if(!found) { printf("未找到匹配事件n"); } } //通过日期删除事件 void deleteByDate(Event *head){ Event *before,*cur; int year; int month; int day; int hour; int minute; printf("请输入日期:yyyy/mm/dd(例如:2025/04/23)\n"); scanf("%d %*c %d %*c %d",&year,&month,&day); printf("请输入具体时间:hh:MM(例如:04:23)\n"); scanf("%d %*c %d ",&hour,&minute); for(before=head,cur=head->next;cur!=NULL;cur=cur->next,before=before->next){ if(cur->day==day && cur->hour==hour && cur->minute==minute && cur->month==month && cur->year==year){ before->next=cur->next; printf("删除成功\n"); break; } } if(cur==NULL){ printf("未找到该事件\n"); } } //通过事件内容删除事件 void deleteByContent(Event *head){ Event *before,*cur; char temp[CONTENT_LENGTH]; printf("请输入事件内容:\n"); gets(temp); for(before=head,cur=head->next;cur!=NULL;before=before->next,cur=cur->next){ if(strcmp(temp,cur->content)==0){ before->next=cur->next; printf("删除成功\n"); break; } } if(cur==NULL){ printf("未找到该事件\n"); } } //修改事件时间 void modifyDate(Event *head) { Event *current = head; char temp[CONTENT_LENGTH]; printf("请输入要查找的事件内容:\n"); fgets(temp, sizeof(temp), stdin); temp[strcspn(temp, "\n")] = '\0'; // 去除换行符 if(!current) { printf("链表为空!\n"); return; } // 正确遍历逻辑 while(current) { if(strcmp(temp, current->content) == 0) { printf("找到事件:\n"); printInfo(current); break; } current = current->next; } if(!current) { printf("未找到事件!\n"); return; } // 安全输入处理 int year, month, day, hour, minute; printf("请输入新日期(yyyy/mm/dd): "); while(scanf("%d/%d/%d", &year, &month, &day) != 3) { printf("格式错误,请重新输入: "); while(getchar() != '\n'); // 清理缓冲区 } printf("请输入新时间(hh:mm): "); while(scanf("%d:%d", &hour, &minute) != 2) { printf("格式错误,请重新输入: "); while(getchar() != '\n'); } // 更新数据 current->year = year; current->month = month; current->day = day; current->hour = hour; current->minute = minute; printf("修改成功!\n"); printInfo(current); // 显示修改结果 } //遍历链表 void travel(Event *head){ head=head->next; while(head!=NULL){ printInfo(head); head=head->next; } } //查找的子菜单,分为 1 遍历 2时间查找 3 事件查找 void find(Event *head){ char decide = 'y'; //定义while变量,函数是否继续进行 int num; //定义switch变量,函数跳转到哪个子函数 while (decide != 'n') { printf(" ***************************************************\n"); printf(" **** 1 遍历 2 时间查找 3 事件查找 4 退出 ****\n"); printf(" ***************************************************\n"); scanf("%d", &num); fflush(stdin); switch (num) { case 1: travel(head); break; case 2: findByDate(head); break; case 3: findByEventContent(head); break; default: decide = 'n'; break; } } } //删除事件的子菜单,分为 1 时间查找删除 2事件查找删除 void eventDelete(Event *head){ char decide = 'y'; //定义while变量,函数是否继续进行 int num; //定义switch变量,函数跳转到哪个子函数 while (decide != 'n') { printf(" ***************************************************\n"); printf(" **** 1 时间查找 2 事件查找 3 退出 ****\n"); printf(" ***************************************************\n"); scanf("%d", &num); fflush(stdin); switch (num) { case 1: deleteByDate(head); break; case 2: deleteByContent(head); break; default: decide = 'n'; break; } } } //储存链表信息 void dataSave(Event *head) //系统的存储函数,由主函数调用 { FILE *fp; char filename[10]; printf("请输入存储文件名(包括物理地址)\n"); scanf("%s",filename); Event *p = (Event *)malloc(sizeof(Event)); p = head->next; if ( (fp=fopen(filename, "w"))== NULL) { printf("cannot open file"); return; } printf("input data:\n"); while (p != NULL) { fwrite(p, sizeof(Event), 1, fp); /* 成块写入文件*/ p = p->next; } fclose(fp); } // 提醒有无即将需要完成的事件 void alert(Event *head){ time_t t; struct tm * lt; time (&t);//获取Unix时间戳。 lt = localtime (&t);//转为时间结构。 printf("当前时间为:"); printf ( "%d/%d/%d %d:%d\n",lt->tm_year+1900, lt->tm_mon+1, lt->tm_mday, lt->tm_hour, lt->tm_min);//输出结果 int flag=0; for(head=head->next;head!=NULL;head=head->next){ if(head->day==lt->tm_mday && head->hour==lt->tm_hour && head->month==lt->tm_mon+1 && head->year==lt->tm_year+1900){ printf("你现在该完成 %s \n",head->content); flag=1; } } if(flag==0){ printf("你现在没有要完成的事件\n"); } } //菜单列表 void menu(){ char decide = 'y'; //定义while变量,函数是否继续进行 int num = 1; //定义switch变量,函数跳转到哪个子函数 Event *head; //定义链表的头指针 head = init(); //给头指针开辟空间 head->next = NULL; //初始化头指针 while (decide != 'n') { printf(" ***************************************************\n"); printf(" ********** 日程管理系统 ********\n"); printf(" ***************************************************\n"); printf(" ********** 1 输入 2 查找 3 修改 4 提醒 ********\n"); printf(" ********** 5 删除 6 存储 7 排序 8 退出 ********\n"); printf(" ***************************************************\n"); scanf("%d", &num); fflush(stdin); switch (num) { case 1: insert(head); break; case 2: find(head); break; case 3: modifyDate(head); break; case 4: alert(head); break; case 5: eventDelete(head); break; case 6: dataSave(head); break; case 7: head=sort(head); break; default: decide = 'n'; break; } }; } //主程序画面函数 int main(){ menu(); return 0; } 根据这个代码画处事件管理模块的流程图,时间排序模块的流程图,提醒模块的流程图,文件存储模块的流程图.
05-23
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值