アットウィキロゴ

課題

#include<iostream>
#include <string>

#include <stdlib.h>
#include <time.h>

using namespace std;

int main(){
	struct tm *date;
time_t now, result;

time(&now);
date = localtime(&now);

	string in;
	int i=0;
	int sun[5]={413,420,427,511,518};

	string week[6][7]={
		{"日","月","火","水","木","金","土"},
		{"なし","なし","C++A","なし","なし","なし","なし"},
		{"なし","英語セミナー","C++B","なし","なし","なし","なし"},
		{"なし","なし","ゼミ","なし","なし","なし","なし"},
		{"なし","デジタル回路実験A","ゼミ","なし","なし","なし","なし"},
		{"なし","デジタル回路実験B","なし","なし","なし","なし","なし"}};
//==================日付の取得と表示オリジナル!!==============================================================
		cout<<"今日は"<<date->tm_year+1900<<"年"<<date->tm_mon+1<<"月"<<date->tm_mday<<"日"<<week[0][date->tm_wday]<<"曜日"<<"です"<<endl;
 		//==========今日の授業を表示オリジナル!!==============================================
		cout<<"今日の授業は"<<endl;
		for(int x=1;x<6;x++) cout<<"    "<<x<<"限目:"<<week[x][date->tm_wday]<<endl;


		cout<<"↓曜日を入力してください 例 月 (日本語入力はAlt+半角/全角)"<<endl;
		cin>>in;

		//===========曜日の検索===============================
		for(i;i<7;i++){
			if(in==week[0][i]) break; 
		}
		if(i==7) {
			cout<<"そんな曜日ないよ"<<endl;
			return 0;
		}
		//=============授業の表示=================================
		for(int j=1;j<6;j++) cout<<j<<"限目:"<<week[j][i]<<endl;

		//================授業の検索=======================================
		cout<<"↓授業を入力して! (414は4月14日)"<<endl;
		cin>>in;
		for(int m=0;m<6;m++){
			for(int n=0;n<7;n++){
				if(in==week[m][n]) {
					for(int o=0;o<5;o++) cout<<sun[o]+n<<endl;
				}
			}
		}		
		return 0;
}

タグ:

+ タグ編集
  • タグ:
最終更新:2008年04月15日 12:09