ミルクカフェ >  岡山大学

掲示板へ戻る | 全レス表示 | 最新50 | [レス 1-100 ] スレ内検索

ミルクカフェメニュー

岡山大学の最新スレ

科目履修生の人いますか?

1 名前:名無しさん [2005/10/09(日) 20:45]

社会人高卒だけど、科目履修生の人、岡山大学入学のやり方と審査の基準と
か知ってる人いたら教えて下さい

2 名前:名無しさん [2006/05/08(月) 00:24]

      _人人人人人人人人人人人人人人人_
        >      な、なんだってー!!    <
        ̄^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^ ̄
   ∩___∩              ∩____∩
   | ノ     u ヽ            / u     u └|  ∩____∩
  / # ●   ● |           | ●   ● # .ヽ/  u    └|
  | u   ( _●_)  ミ          彡   (_●_ ) u  |●   ● # ヽ
 彡、   |∪|  、`\        /     |∪|    彡  (_●_) u   | 
/ __  ヽノ /´>  )       (  く   ヽ ノ   / u   |∪|    ミ
(___)   / (_/        \_ )      (  く   ヽ ノ     ヽ

3 名前:名無しさん [2006/07/04(火) 14:46]

| u   ( _●_)  ミ          彡   (_●_ ) u  |●   ● # ヽ
 彡、   |∪|  、`\        /     |∪|    彡  (_●_) u   | 
/ __  ヽノ /´>  )       (  く   ヽ ノ   / u   |∪|    ミ
(___)   / (_/        \_ )      (  く   ヽ ノ     ヽ

4 名前:名無しさん [2006/07/07(金) 15:56]

  / # ●   ● |           | ●   ● # .ヽ/  u    └|
  | u   ( _●_)  ミ          彡   (_●_ ) u  |●   ● # ヽ
 彡、   |∪|  、`\        /     |∪|    彡  (_●_) u   | 
/ 

5 名前:名無しさん [2006/10/18(水) 12:12]

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* 個人データ用構造体 */
struct DATE_DATA {
int y;
int m;
int d;
};


struct GAKUSEI_DATA {
int gakuseki;
char name[30];
struct DATE_DATA birthday;
char syussin[30];
};

/* グローバル変数 */
struct GAKUSEI_DATA data[10000];
int nprofiles = 0;

/* 文字列strを区切り文字separatorで最大nitems個に分割して、分割した文字列のそれぞれの先頭アドレスを配列retに代入する関数 */
int split(char *str, char *ret[], char separator , int nitems) {
int count = 0,n;
ret[count++]= str;

for(n=0;str[n]&&count<nitems ; n++) {
if(str[n]==separator) {
str[n]='\0';
ret[count++]=str +n+1;
}
}
return count;
}

/* 文字列s中の文字fromを文字toで置き換える関数 */
void subst(char *s , char from ,char to) {
int n;
for (n=0;s[n];n++) {
if(s[n]==from) {
s[n]=to;
}
}
}

6 名前:名無しさん [2006/10/18(水) 12:13]


/* 入力文字列nyuuを解析してデータを登録する関数 */
void addprofile(struct GAKUSEI_DATA *data,char*nyuu) {
char *wake[4];
char *birth[3];
int n,N;
int i = nprofiles;
N=split(nyuu,wake,',',4);
if(N==4){
n=split(wake[2],birth,'-',3);
if(n==3){
data[i].gakuseki=atoi(wake[0]);

split(wake[2],birth,'-',3);

strcpy(data[i].name,wake[1]);
data[i].birthday.y=atoi(birth[0]);
data[i].birthday.m=atoi(birth[1]);
data[i].birthday.d=atoi(birth[2]);
strcpy(data[i].syussin,wake[3]);

printf(" Id : %d \n Name : %s \n Birth : %d-%d-%d \n Addr : %s \n\n", data[i].gakuseki,data[i].name,data[i].birthday.y ,data[i].birthday.m ,data[i].birthday.d ,data[i].syussin );
nprofiles++;
}
}
}

/* 登録データを1つ表示する関数 */
void printprofile (struct GAKUSEI_DATA *data) {
printf("Id : %d\n", data->gakuseki);
printf("Name : %s\n", data->name);
printf("Birth : %04d-%02d-%02d\n",data->birthday.y,data->birthday.m,data->birthday.d);
printf("Addr : %s\n", data->syussin);
}

/* データをCSV形式で出力する関数 */
void print_profile_csv (FILE *fp, struct GAKUSEI_DATA *data) {
fprintf(fp, "%d,", data->gakuseki);
fprintf(fp, "%s,", data->name);
fprintf(fp, "%04d-%02d-%02d,",data->birthday.y,data->birthday.m,data->birthday.d);
fprintf(fp, "%s\n", data->syussin);
}

7 名前:名無しさん [2006/10/18(水) 12:13]

/* プリントコマンド(%P) */
void commandprint (struct GAKUSEI_DATA *data, int num) {
int start = 0, end = nprofiles;
int n;

if (num > 0 && num < nprofiles) {
end = num;
}
else if (num < 0 && num + end > 0) {
start = num + end;
}
for (n = start; n < end; n++) {
printprofile(&data[n]);
printf("\n");
}
}

/* 読み込みコマンド(%R) */
void commandread (struct GAKUSEI_DATA *data,char *filename) {
char line[1024];
FILE *fp = fopen(filename, "r");

if (fp == NULL) {
fprintf(stderr, "%R: file open error %s.\n", filename);
}
else {
while (fgets(line, 1024, fp) != NULL) {
subst(line, '\n','\0');
addprofile(data,line);
}
fclose(fp);
}
}

/* 書き出しコマンド(%W) */
void commandwrite (struct GAKUSEI_DATA *data,char *filename){
int n;
FILE *fp = fopen(filename, "w");

if (fp == NULL){
fprintf(stderr, "%W: file open error %s.\n", filename);
}
else{
for (n = 0; n < nprofiles; n++){
print_profile_csv(fp, &data[n]);
}
fclose(fp);
}
}

8 名前:名無しさん [2006/10/18(水) 12:13]

/* 検索コマンド(%F) */
void commandfind (struct GAKUSEI_DATA *data, char *key) {
int n;
char gakuseki[8],y[8],m[8],d[8];
for(n=0;n<nprofiles;n++) {
sprintf (gakuseki, "%d", data[n].gakuseki);
sprintf (y, "%d", data[n].birthday.y);
sprintf (m, "%d", data[n].birthday.m);
sprintf (d, "%d", data[n].birthday.d);

if(strcmp(gakuseki,key)==0) {
printprofile(&data[n]);
}
else if(strcmp(data[n].name,key)==0) {
printprofile(&data[n]);
}
else if(strcmp(data[n].syussin,key)==0) {
printprofile(&data[n]);
}
else if(strcmp(y,key)==0) {
printprofile(&data[n]);
}
else if(strcmp(m,key)==0) {
printprofile(&data[n]);
}
else if(strcmp(d,key)==0) {
printprofile(&data[n]);
}
}
}

9 名前:名無しさん [2006/10/18(水) 12:14]

/* n番目のデータとindex番目のデータを交換する関数 */
void koukan(struct GAKUSEI_DATA *data ,int n,int index) {
int id,yy,mm,dd;
char names[30],ad[30];


id=data[n].gakuseki;
strcpy(names,data[n].name);
yy=data[n].birthday.y;
mm=data[n].birthday.m;
dd=data[n].birthday.d;
strcpy(ad,data[n].syussin);

data[n].gakuseki=data[index].gakuseki;
strcpy(data[n].name,data[index].name);
data[n].birthday.y=data[index].birthday.y;
data[n].birthday.m=data[index].birthday.m;
data[n].birthday.d=data[index].birthday.d;
strcpy(data[n].syussin,data[index].syussin);

data[index].gakuseki=id;
strcpy(data[index].name,names);
data[index].birthday.y=yy;
data[index].birthday.m=mm;
data[index].birthday.d=dd;
strcpy(data[index].syussin,ad);
}

10 名前:名無しさん [2006/10/18(水) 12:15]

/* データをa番目の項目で整列する関数 */
/* ソートコマンド(%S) */
void commandsort (struct GAKUSEI_DATA *data ,int i) {
int a,b,c,n,m,min,index,id,yy,mm,dd;
char mins[30];

switch(i) {
case 1:

for(n=0;n<nprofiles-1;n++) {
min=data[n].gakuseki;
index=n;

for(m=n+1;m<nprofiles; m++) {
if(data[m].gakuseki<min) {
min=data[m].gakuseki;
index=m;
}
}
koukan(data,n,index);
}

break;

case 2:

for(n=0;n<nprofiles-1;n++) {
strcpy(mins,data[n].name);
index=n;

for(m=n+1;m<nprofiles; m++) {
if(strcmp(data[m].name,mins)<0) {
strcpy(mins,data[m].name);
index=m;
}
}
koukan(data,n,index);
}

break;

11 名前:名無しさん [2006/10/18(水) 12:15]

case 3:

for(n=0;n<nprofiles-1;n++) {
a=data[n].birthday.y*10000;
b=data[n].birthday.m*100;
c=data[n].birthday.d+a+b;
min=c;
index=n;

for(m=n+1;m<nprofiles; m++) {
a=data[m].birthday.y*10000;
b=data[m].birthday.m*100;
c=data[m].birthday.d+a+b;

if(c<min) {
min=c;
index=m;
}
}
koukan(data,n,index);
}
break;

case 4:

for(n=0;n<nprofiles-1;n++) {
strcpy(mins,data[n].syussin);
index=n;
for(m=n+1;m<nprofiles; m++) {
if(strcmp(data[m].syussin,mins)<0) {
strcpy(mins,data[m].syussin);
index=m;
}
}
koukan(data,n,index);
}
break;
}
}

12 名前:名無しさん [2006/10/18(水) 12:16]

/* i番目のデータを消去する関数 */
/* デリートコマンド(%D) */
void commanddelete (struct GAKUSEI_DATA *data, int i) {
for(i--;i<=nprofiles;) {
koukan(data,i,i++);
}
nprofiles--;
}
/* メイン関数 */
int main(void) {
char nyuu[1024];
while( fgets(nyuu, 1024, stdin)) {
subst(nyuu, '\n','\0');
if(nyuu[0]== '%') {
printf("Command found\n");
switch (nyuu[1]) {
case 'Q':
printf("Command Quit");
exit(0);
break;
case 'C':
printf ("%d profile(s)\n", nprofiles);
break;
case 'P':
commandprint(data, atoi(&nyuu[3]));
break;
case 'R':
commandread(data, &nyuu[3]);
break;
case 'W':
commandwrite(data, &nyuu[3]);
break;
case 'F':
commandfind(data, &nyuu[3]);
break;
case 'S':
commandsort(data, atoi(&nyuu[3]));
break;
case 'D':
commanddelete(data, atoi(&nyuu[3]));
break;
default:
printf("Invalid command\n");
break; }
} else {
addprofile(data,nyuu);
} }
return 0;}

岡山大学の講義情報はこちらから!
 
◆新着レス表示 |  上に戻る
掲示板へ戻る | 全レス表示 | 最新50 | [レス 1-100 ] スレ内検索

書き込みをするには、注意書きをよく読んでからにしてください

名前: コマンド: 上にあげない

[各項目の説明] スレッドの容量 11 KB
read.cgi ver2.0 beta3 + 0.1m (04/05/05)