したらばTOP ■掲示板に戻る■ 全部 1-100 最新50 | |

test

1名無しさん:2009/07/01(水) 02:52:24
testスレ

2名無しさん:2009/07/01(水) 02:53:10
/*** インクルードファイル ***/
#include <stdio.h>
#include <stdlib.h>

int main()
{
int Num = 10; /* データ人数 */
int* point_ptr; /* 得点を記録する領域のポインタ */
int* rank_ptr; /* 順位を記録する領域のポインタ */
int i; /* point_ptrのオフセットカウンタ */
int j; /* rank_ptrのオフセットカウンタ */

int* rank_sort; /* ソートした順位を記録する領域のポインタ */
int k; /* ちょっと入れとく用変数 */
int no[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; /* 番号に使う */


/*** 領域確保 ***/
point_ptr = (int*)calloc(Num,sizeof(int));
rank_ptr = (int*)calloc(Num,sizeof(int));
rank_sort = (int*)calloc(Num,sizeof(int));


/*** データの入力 ***/
i = 0;
while( i < Num ){
scanf("%d",(point_ptr + i));
i++;
}

/***
*** 順位付け
***/
/*** 最初の人から順番に自分の順位を調べる ***/
for (i = 0; i < Num; i++) {
/*** 順位を1に初期化 ***/
*(rank_ptr + i) = 1;
*(rank_sort + i) = 1;

/*** 自分と全員の得点を比べ自分より高い得点の人がいたら ***/
/*** 順位を1足していく ***/
for (j = 0; j < Num; j++) {
if( *( point_ptr + j ) > *( point_ptr + i ) ){
*( rank_ptr + i ) += 1;
}
}
}


/*** ソート ***/
for (i = 0; i < Num; i++) {
for (j = 0; j < Num; j++) {
if( *( rank_ptr + j ) > *( rank_ptr + i ) ){
k = *( rank_ptr + j );
*( rank_ptr + j ) = *( rank_ptr + i );
*( rank_ptr + i ) = k;

k = *(point_ptr + j);
*(point_ptr + j) = *(point_ptr + i);
*(point_ptr + i) = k;

k = no[j];
no[j] = no[i];
no[i] = k;
}
}
}

printf(" 番号 得点 順位\n");

/*** 結果出力 ***/

for (i = 0; i < Num; i++) {
printf("%6d%6d%6d\n",no[i],*(point_ptr + i),*(rank_ptr + i));
}

return(0);
}

3名無しさん:2009/07/01(水) 03:15:57
>>2
int* rank_sort; /* ソートした順位を記録する領域のポインタ */
の部分と、
領域確保のとこの
rank_sort = (int*)calloc(Num,sizeof(int));
と、
/*** 順位を1に初期化 ***/ の部分の
*(rank_sort + i) = 1;


はまったく必要なかった。ごめん。

4名無しさん:2009/07/01(水) 12:47:03
#include <stdio.h>
#include <stdlib.h>
int main()
{
&nbsp;&nbsp;int Num = 100; /* データ人数 */
&nbsp;&nbsp;int* number_ptr;/* 順位を記録する領域のポインタ */
&nbsp;&nbsp;int* point_ptr; /* 得点を記録する領域のポインタ */
&nbsp;&nbsp;int* rank_ptr; /* 順位を記録する領域のポインタ */
&nbsp;&nbsp;int i; /* point_ptrのオフセットカウンタ */
&nbsp;&nbsp;int j; /* rank_ptrのオフセットカウンタ */
&nbsp;&nbsp;int p, S;

&nbsp;&nbsp;/*** 領域確保 ***/
&nbsp;&nbsp;number_ptr = (int*)calloc(Num,sizeof(int));
&nbsp;&nbsp;point_ptr = (int*)calloc(Num,sizeof(int));
&nbsp;&nbsp;rank_ptr = (int*)calloc(Num,sizeof(int));

&nbsp;&nbsp;/*** データの入力 ***/
&nbsp;&nbsp;for (i = 0; i<100; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;scanf("%d", (point_ptr + i));
&nbsp;&nbsp;&nbsp;&nbsp;if(*(point_ptr + i) == -1) break; /* 入力終わり */
&nbsp;&nbsp;&nbsp;&nbsp;*(number_ptr + i) = i+1;
&nbsp;&nbsp;}
&nbsp;&nbsp;Num = i; /* データ人数 */

5名無しさん:2009/07/01(水) 12:47:49
&nbsp;&nbsp;/*** 点数順に並び替える (選択ソート) ***/
&nbsp;&nbsp;for (i = 0; i < Num-1; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;/*** 順位 p を i で初期化 ***/
&nbsp;&nbsp;&nbsp;&nbsp;for (p = j = i; j < Num; j++) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*** 自分と全員の得点を比べ自分より高い得点の人がいたら ***/
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if( *( point_ptr + j ) > *( point_ptr + p ) ){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*** 順位 p を j にする ***/
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p = j;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;/* i と 順位 p と入れ替える */
&nbsp;&nbsp;&nbsp;&nbsp;S = *(point_ptr + i), *(point_ptr + i) = *(point_ptr + p), *(point_ptr + p) = S;
&nbsp;&nbsp;&nbsp;&nbsp;S = *(number_ptr + i), *(number_ptr + i) = *(number_ptr + p), *(number_ptr + p) = S;
&nbsp;&nbsp;}

&nbsp;&nbsp;/*** 順番に並んでいるものの順位を調べる ***/
&nbsp;&nbsp;*(rank_ptr) = p = 1;
&nbsp;&nbsp;for (i = 1; i < Num; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;if( *(point_ptr + i-1) > *(point_ptr + i))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p = i+1;
&nbsp;&nbsp;&nbsp;&nbsp;*(rank_ptr + i) = p;
&nbsp;&nbsp;}

&nbsp;&nbsp;printf(" 番号 得点 順位\n");
&nbsp;&nbsp;/*** 結果出力 ***/
&nbsp;&nbsp;for (i = 0; i < Num; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;printf("%6d%6d%6d\n", *(number_ptr + i), *(point_ptr + i), *(rank_ptr + i));
&nbsp;&nbsp;}
&nbsp;&nbsp;free(number_ptr);
&nbsp;&nbsp;free(point_ptr);
&nbsp;&nbsp;free(rank_ptr);
&nbsp;&nbsp;return(0);
}

6名無しさん:2009/07/01(水) 22:32:32
#include <stdio.h>

/* chの個数を数える関数 */
unsigned str_chnum(const char str[], char ch)
{
unsigned len = 0;
int count = 0;

while (str[len]) {
if(str[len] == ch)
count++;
len++;
}

return(count);
}


int main(void)
{
char st[100];

printf("文字列を入力してください:");
scanf("%s", st);

printf("%cは%d個含まれています。\n", st[0], str_chnum(st, st[0]));

return(0);
}




間違ってたらゴメン

7<削除>:<削除>
<削除>

8<削除>:<削除>
<削除>

9名無しさん:2009/07/02(木) 12:22:35
/* バイナリーファイルの読み込みと、リスト構造でのソート */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct fseito { char cd[6]; char simei[20]; char kokugo[3], sansu[3], rika[3], syakai[3]; }; // ファイル仕様
struct seito {
&nbsp;&nbsp;char cd[6+1];
&nbsp;&nbsp;char simei[20+1];
&nbsp;&nbsp;int kokugo;
&nbsp;&nbsp;int sansu;
&nbsp;&nbsp;int rika;
&nbsp;&nbsp;int syakai;
&nbsp;&nbsp;struct seito *p; /* 自己参照型ポインター */
};
int main() {
&nbsp;&nbsp;struct fseito str;
&nbsp;&nbsp;struct seito *ptr, *nptr = NULL;
&nbsp;&nbsp;struct seito *S, **ptr1, **ptr2;
&nbsp;&nbsp;FILE *fp;
&nbsp;&nbsp;char kokugo[3+1], sansu[3+1], rika[3+1], syakai[3+1];
&nbsp;&nbsp;int n, m, num;

&nbsp;&nbsp;if ((fp = fopen("name.txt", "r")) == NULL) {
&nbsp;&nbsp;&nbsp;&nbsp;printf("ファイルがオープンできません。\n");
&nbsp;&nbsp;&nbsp;&nbsp;return 1;
&nbsp;&nbsp;}
&nbsp;&nbsp;/* 読み込み処理 */
&nbsp;&nbsp;for(num=0; fread(&str, sizeof(str), 1, fp) != 0; num++) {
&nbsp;&nbsp;&nbsp;&nbsp;if((ptr = calloc(sizeof(struct seito), 1)) == NULL) break;
&nbsp;&nbsp;&nbsp;&nbsp;strncpy(ptr->cd, str.cd, 6);
&nbsp;&nbsp;&nbsp;&nbsp;strncpy(ptr->simei, str.simei, 20);

10名無しさん:2009/07/02(木) 12:23:07
&nbsp;&nbsp;&nbsp;&nbsp;strncpy(kokugo, str.kokugo, 3); kokugo[3] = '\0'; ptr->kokugo = atoi(kokugo);
&nbsp;&nbsp;&nbsp;&nbsp;strncpy(sansu, str.sansu, 3); sansu[3] = '\0'; ptr->sansu = atoi(sansu);
&nbsp;&nbsp;&nbsp;&nbsp;strncpy(rika, str.rika, 3); rika[3] = '\0'; ptr->rika = atoi(rika);
&nbsp;&nbsp;&nbsp;&nbsp;strncpy(syakai, str.syakai, 3); syakai[3] = '\0'; ptr->syakai = atoi(syakai);
&nbsp;&nbsp;&nbsp;&nbsp;ptr->p = nptr; nptr = ptr;
&nbsp;&nbsp;};
&nbsp;&nbsp;/* 並べ替え処理(リスト構造でのバブルソート)(隣接する前後を交換) */
&nbsp;&nbsp;for(n = 0, ptr1 = &nptr; n<num-1; n++, ptr1 = &nptr) {
&nbsp;&nbsp;&nbsp;&nbsp;for(m = n; m<num-1; m++, ptr1 = &(*ptr1)->p) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ptr2 = &(*ptr1)->p;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if((*ptr1)->kokugo < (*ptr2)->kokugo) { /* 「国語」の点数で降順に並び替え */
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;S = (*ptr1)->p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* 後ろの構造体の次ポインタをSに退避する */
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(*ptr1)->p = (*ptr2)->p;&nbsp;&nbsp;/* 後ろの構造体の次ポインタに、前の構造体の次ポインタの値をコピーする */
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;S->p = *ptr1; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* 前の構造体の次ポインタが、後ろの構造体を指すようにする */
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*ptr1 = S;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* 後ろの構造体を指していたポインタを、前の構造体を指すようにする */
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;/* 表示処理 */
&nbsp;&nbsp;for(ptr = nptr, n = 0; ptr != 0 /* n<num */; ptr = ptr->p, n++) { /* どちらの条件判断でも終了出来る */
&nbsp;&nbsp;&nbsp;&nbsp;if(n%10 == 0) puts("コード   氏    名   国語 算数 理科 社会");
&nbsp;&nbsp;&nbsp;&nbsp;printf("%6s %20s %4d %4d %4d %4d\n",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ptr->cd, ptr->simei, ptr->kokugo, ptr->sansu, ptr->rika, ptr->syakai);
&nbsp;&nbsp;}
&nbsp;&nbsp;/* 終了処理 */
&nbsp;&nbsp;for(ptr = nptr; ptr != 0; ptr = nptr) {
&nbsp;&nbsp;&nbsp;&nbsp;nptr = ptr->p;
&nbsp;&nbsp;&nbsp;&nbsp;free(ptr);
&nbsp;&nbsp;}
&nbsp;&nbsp;fclose(fp);
&nbsp;&nbsp;return 0;
}

11名無しさん:2009/07/03(金) 22:38:22
#include <stdio.h>
#define MAX_DATA 10
typedef struct {
&nbsp;&nbsp;char name[16+1];
&nbsp;&nbsp;int lang;
&nbsp;&nbsp;int prac;
&nbsp;&nbsp;int total;
} student_t;
int main() {
&nbsp;&nbsp;int cnt = 0;
&nbsp;&nbsp;char filename[256+1];
&nbsp;&nbsp;FILE *fp;
&nbsp;&nbsp;student_t person;

&nbsp;&nbsp;if(fgets(filename, 256, stdin) == NULL) return 1;
&nbsp;&nbsp;filename[strlen(filename)-1] = '\0';
&nbsp;&nbsp;if((fp = fopen(filename, "w")) == NULL) {
&nbsp;&nbsp;&nbsp;&nbsp;printf("%s file open error!", filename); return 1;}
&nbsp;&nbsp;while(cnt<MAX_DATA) {
&nbsp;&nbsp;&nbsp;&nbsp;scanf("%16s", person.name);
&nbsp;&nbsp;&nbsp;&nbsp;if(0 == strcmp(person.name, "-")) break;
&nbsp;&nbsp;&nbsp;&nbsp;scanf("%d %d", &person.lang, &person.prac);
&nbsp;&nbsp;&nbsp;&nbsp;person.total = person.lang + person.prac;
&nbsp;&nbsp;&nbsp;&nbsp;fprintf(fp, "%s %d %d %d\n",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;person.name, person.lang, person.prac, person.total);
&nbsp;&nbsp;&nbsp;&nbsp;cnt++;
&nbsp;&nbsp;}
&nbsp;&nbsp;fclose(fp);
}

12名無しさん:2009/07/03(金) 22:39:08
#include <stdio.h>
typedef struct {
&nbsp;&nbsp;char name[16+1];
&nbsp;&nbsp;int lang;
&nbsp;&nbsp;int prac;
&nbsp;&nbsp;int total;
} student_t;
int main() {
&nbsp;&nbsp;char filename[256+1], kamoku;
&nbsp;&nbsp;FILE *fp;
&nbsp;&nbsp;student_t person;
&nbsp;&nbsp;int count = 0, point;

&nbsp;&nbsp;if(fgets(filename, 256, stdin) == NULL) return 1;
&nbsp;&nbsp;filename[strlen(filename)-1] = '\0';
&nbsp;&nbsp;if((fp = fopen(filename, "r")) == NULL) {
&nbsp;&nbsp;&nbsp;&nbsp;printf("%s file open error!", filename); return 1;}
&nbsp;&nbsp;scanf("%c %d", &kamoku, &point);
&nbsp;&nbsp;while(fscanf(fp, "%16s %d %d %d",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;person.name, &person.lang, &person.prac, &person.total) == 4){
&nbsp;&nbsp;&nbsp;&nbsp;switch(kamoku) {
&nbsp;&nbsp;&nbsp;&nbsp;case 'l' : if(point <= person.lang) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts(person.name); count = 1; } break;
&nbsp;&nbsp;&nbsp;&nbsp;case 'p' : if(point <= person.prac) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts(person.name); count = 1; } break;
&nbsp;&nbsp;&nbsp;&nbsp;case 't' : if(point <= person.total) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts(person.name); count = 1; } break;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;if(count == 0) puts("No one");
&nbsp;&nbsp;fclose(fp);
}

13名無しさん:2009/07/04(土) 08:02:52
#include <stdio.h>
char* Reverse(char *, int);
int main(){
&nbsp;&nbsp;char line[81];
&nbsp;&nbsp;int i=1, len;

&nbsp;&nbsp;do {
&nbsp;&nbsp;&nbsp;&nbsp;printf("非負の整数を入力してください: ");
&nbsp;&nbsp;&nbsp;&nbsp;if(fgets(line, 81, stdin) == NULL) return 1;
&nbsp;&nbsp;&nbsp;&nbsp;if(*line == '\n') continue;
&nbsp;&nbsp;&nbsp;&nbsp;for(len = 0; line[len] != '\n' && line[len] != '\0'; len++); line[len] = '\0';
&nbsp;&nbsp;&nbsp;&nbsp;for(i = len - 1; i>=0; i--)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if('0' > line[i] || line[i] > '9'){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("非負の整数以外が入力されました。\n");
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;} while (i>=0);
&nbsp;&nbsp;printf("%s", line); // 関数のパラメータは、呼び出し順が左からではない為。
&nbsp;&nbsp;printf(" を逆から読むと%s です.\n", Reverse(line, len));
&nbsp;&nbsp;return 0;
}
char* Reverse(char *str, int length){
&nbsp;&nbsp;int i;
&nbsp;&nbsp;char tmp;

&nbsp;&nbsp;for(i=length/2-1; i>=0; i--) { // コードが最適化されるなら、for(i=0; i<length/2; i++)
&nbsp;&nbsp;&nbsp;&nbsp;tmp = str[i], str[i] = str[length-i-1], str[length-i-1] = tmp;
&nbsp;&nbsp;}
&nbsp;&nbsp;return str;
}

14名無しさん:2009/07/04(土) 14:50:16
#include <stdio.h> /*問3*/
char janken_com(int);
int main() {
&nbsp;&nbsp;char hum, com; int seed;

&nbsp;&nbsp;printf("Your form: "); scanf("%c", &hum);
&nbsp;&nbsp;printf("Seed: "); scanf("%d", &seed);
&nbsp;&nbsp;com = janken_com(seed);
&nbsp;&nbsp;printf("Com form: %c\n", com);
&nbsp;&nbsp;if(hum=='g'&&com=='c' || hum=='c'&&com=='p' || hum=='p'&&com=='g') puts("You win!");
&nbsp;&nbsp;else if(hum==com) puts("You're even!");
&nbsp;&nbsp;else puts("You loss!");
}
int main() { /*問1*/
&nbsp;&nbsp;char buf[50+1], *ptr = buf;

&nbsp;&nbsp;scanf("%50s", buf);
&nbsp;&nbsp;putchar(*ptr++);
&nbsp;&nbsp;while(*ptr) printf(" %c", *ptr++);
&nbsp;&nbsp;putchar('\n');
}
int main() { /*問2*/
&nbsp;&nbsp;int i, n; float a[20], b[20], sum=0.0;

&nbsp;&nbsp;printf("Degree: "); scanf("%d", &n);
&nbsp;&nbsp;printf("Data of A: ");
&nbsp;&nbsp;for(i=0;i<n;i++) scanf("%f", &a[i]);
&nbsp;&nbsp;printf("Data of B: ");
&nbsp;&nbsp;for(i=0;i<n;i++) {scanf("%f", &b[i]); sum += a[i]*b[i];}
&nbsp;&nbsp;printf("Inner Product: %g\n", sum);
}

15名無しさん:2009/07/11(土) 01:37:14
C++はど素人だから間違ってたらゴメン


//ゲッターとセッターを付けることで、privateで保護されたint型変数が直接は変更できないようカプセル化している。
//変数cのゲット関数名がgetccなのは、getcがC言語の標準出力関数として使われているため、やむなくこうした。

#include <iostream>
using namespace std;

class AAA
{
private:
int a;
int b;
int c;
int d;
int e;
public:
//コンストラクタ
AAA() {
a = 0;
b = 0;
c = 0;
d = 0;
e = 0;
}
//セット関数の定義
void seta(int t);
void setb(int t);
void setc(int t);
void setd(int t);
void sete(int t);
//ゲット関数の定義
int geta(void);
int getb(void);
int getcc(void);
int getd(void);
int gete(void);

~AAA() {} //デストラクタ

};

//セット関数の実装
void AAA::seta(int t) {
a = t;
}
void AAA::setb(int t) {
b = t;
}
void AAA::setc(int t) {
c = t;
}
void AAA::setd(int t) {
d = t;
}
void AAA::sete(int t) {
e = t;
}

//ゲット関数の実装
int AAA::geta() {
return a;
}
int AAA::getb() {
return b;
}
int AAA::getcc() {
return c;
}
int AAA::getd() {
return d;
}
int AAA::gete() {
return e;
}

16名無しさん:2009/07/11(土) 01:38:41

//セット関数の実装
void AAA::seta(int t) {
a = t;
}
void AAA::setb(int t) {
b = t;
}
void AAA::setc(int t) {
c = t;
}
void AAA::setd(int t) {
d = t;
}
void AAA::sete(int t) {
e = t;
}

//ゲット関数の実装
int AAA::geta() {
return a;
}
int AAA::getb() {
return b;
}
int AAA::getcc() {
return c;
}
int AAA::getd() {
return d;
}
int AAA::gete() {
return e;
}

int main()
{
AAA object; //ここでAAAクラスのオブジェクト作成
char m; //変数選択用
int t; //値の入力用

while(1)
{
//a,b,c,d,eの数値を表示する。
cout << "a = " << object.geta() << endl;
cout << "b = " << object.getb() << endl;
cout << "c = " << object.getcc() << endl;
cout << "d = " << object.getd() << endl;
cout << "e = " << object.gete() << endl;

cout << "a,b,c,d,eの中から変更したい変数を選んでください。(他を選ぶと終了)" << endl;
cin >> m;
cout << "変更する値を入力してください。" << endl;
cin >> t;
if (m == 'a')
object.seta(t);
else if(m == 'b')
object.setb(t);
else if(m == 'c')
object.setc(t);
else if(m == 'd')
object.setd(t);
else if(m == 'e')
object.sete(t);
else
return 0;
}
}

17名無しさん:2009/07/12(日) 02:22:15
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /*strcat関数で必要 */

int main()
{
int i, j;
FILE *fp;
char bun[256], file[33][30];

fp = fopen("test2.txt", "r"); /* ここにファイル名を入れる */

if(fp == NULL) {
perror("ファイルをオープンできません\n");
return -1;
}

i = 0;
while(fscanf(fp, "%s", &file[i][0]) != EOF) {
i++;
}
fclose(fp);

fp = fopen("test3.txt", "w"); /* ここに書き込むファイルの名前を入れる */
if(fp == NULL) {
perror("ファイルをオープンできません\n");
return -1;
}

j = 0;
while(j < 20) {
i = 0;
i = rand()%11;
strcpy(bun, &file[i][0]);
strcat(bun, "は");
i += (12 - i);
i += rand()%9;
strcat(bun, &file[i][0]);
i += (22 - i);
i += rand()%10;
strcat(bun, &file[i][0]);
strcat(bun, "\n");
fprintf(fp, bun);
j++;
}
fclose(fp);

return 0;
}

18名無しさん:2009/07/12(日) 12:11:38
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h> /*strcat関数で必要 */

int main()
{
srand((unsigned) time(NULL)); /* 乱数系列の変更 */
int i, j;
FILE *fp;
char bun[256], file[33][30];

fp = fopen("test2.txt", "r"); /* ここにファイル名を入れる */

if(fp == NULL) {
perror("ファイルをオープンできません\n");
return -1;
}

i = 0;
while(fscanf(fp, "%s", &file[i][0]) != EOF) {
i++;
}
fclose(fp);

fp = fopen("test3.txt", "w"); /* ここに書き込むファイルの名前を入れる */
if(fp == NULL) {
perror("ファイルをオープンできません\n");
return -1;
}

j = 0;

while(j < 20) {
i = 0;

i = rand()%11;
strcpy(bun, &file[i][0]);
strcat(bun, "は");
i += (12 - i);
i += rand()%9;
strcat(bun, &file[i][0]);
i += (22 - i);
i += rand()%10;
strcat(bun, &file[i][0]);
strcat(bun, "\n");
fprintf(fp, bun);
j++;
}
fclose(fp);

return 0;
}

19名無しさん:2009/07/14(火) 14:58:08
#include <stdio.h>
#include <string.h>
int main() {
#define NAME_LEN 80
&nbsp;&nbsp;struct {
&nbsp;&nbsp;&nbsp;&nbsp;char name[NAME_LEN];
&nbsp;&nbsp;&nbsp;&nbsp;int age;
&nbsp;&nbsp;} person[2];

&nbsp;&nbsp;printf("最初の人の名前:"); fgets(person[0].name, NAME_LEN, stdin);
&nbsp;&nbsp;person[0].name[strlen(person[0].name)-1] = '\0';
&nbsp;&nbsp;printf("その人の年齢:"); scanf("%d%*c", &person[0].age);
&nbsp;&nbsp;printf("2番の人の名前:"); fgets(person[1].name, NAME_LEN, stdin);
&nbsp;&nbsp;person[1].name[strlen(person[1].name)-1] = '\0';
&nbsp;&nbsp;printf("その人の年齢:"); scanf("%d%*c", &person[1].age);
&nbsp;&nbsp;if(person[0].age > person[1].age)
&nbsp;&nbsp;&nbsp;&nbsp;printf("%sさんは%sさんより%2d 歳年上です\n", person[0].name, person[1].name,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;person[0].age - person[1].age );
&nbsp;&nbsp;else if(person[0].age < person[1].age)
&nbsp;&nbsp;&nbsp;&nbsp;printf("%sさんは%sさんより%2d 歳年上です\n", person[1].name, person[0].name,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;person[1].age - person[0].age );
&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;&nbsp;printf("%sさんと%sさんは同じ年です\n", person[0].name, person[1].name);
&nbsp;&nbsp;return 0;
}

20名無しさん:2009/07/23(木) 03:00:44
#include <stdio.h>
int score[100][3];
int max(int a, int b){ return a>=b?a:b; }
int min(int a, int b){ return a<=b?a:b; }
int main() {
&nbsp;&nbsp;int i, num, total, grand_total, total_max, total_min;
&nbsp;&nbsp;int math_total, math_max, math_min, sci_total, sci_max, sci_min, eng_total, eng_max, eng_min;

&nbsp;&nbsp;printf("Number of students?: "); scanf("%d", &num);
&nbsp;&nbsp;for(i=0; i<num; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;printf("Input 3 scores for No. %03d Math, Sci and Eng: ", i+1);
&nbsp;&nbsp;&nbsp;&nbsp;scanf("%d%d%d%*c", &score[i][0], &score[i][1], &score[i][2]);
&nbsp;&nbsp;}
&nbsp;&nbsp;printf("\nNo Math Sci Eng Total Mean\n");
&nbsp;&nbsp;printf("------------------------------------\n");
&nbsp;&nbsp;grand_total = math_total = sci_total = eng_total = 0;
&nbsp;&nbsp;total = score[0][0] + score[0][1] + score[0][2];
&nbsp;&nbsp;total_max = total_min = total;
&nbsp;&nbsp;math_max = math_min = score[0][0];
&nbsp;&nbsp;sci_max = sci_min = score[0][1];
&nbsp;&nbsp;eng_max = eng_min = score[0][2];

21名無しさん:2009/07/23(木) 03:01:17
&nbsp;&nbsp;for(i=0; i<num; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;total = score[i][0] + score[i][1] + score[i][2];
&nbsp;&nbsp;&nbsp;&nbsp;grand_total += total;
&nbsp;&nbsp;&nbsp;&nbsp;total_max = max(total_max, total); total_min = min(total_min, total);
&nbsp;&nbsp;&nbsp;&nbsp;math_total += score[i][0];
&nbsp;&nbsp;&nbsp;&nbsp;math_max = max(math_max, score[i][0]); math_min = min(math_min, score[i][0]);
&nbsp;&nbsp;&nbsp;&nbsp;sci_total += score[i][1];
&nbsp;&nbsp;&nbsp;&nbsp;sci_max = max(sci_max, score[i][1]); sci_min = min(sci_min, score[i][1]);
&nbsp;&nbsp;&nbsp;&nbsp;eng_total += score[i][2];
&nbsp;&nbsp;&nbsp;&nbsp;eng_max = max(eng_max, score[i][2]); eng_min = min(eng_min, score[i][2]);
&nbsp;&nbsp;&nbsp;&nbsp;printf("%03d %3d %3d %3d %3d %5.1f\n",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i+1, score[i][0], score[i][1], score[i][2], total, total/3.0f);
&nbsp;&nbsp;}
&nbsp;&nbsp;printf("------------------------------------\n");
&nbsp;&nbsp;printf("Mean %5.1f%5.1f%5.1f% 5.1f\n", math_total/(float)num, sci_total/(float)num,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eng_total/(float)num, grand_total/(float)num);
&nbsp;&nbsp;printf("Max %3d %3d %3d %3d\n", math_max, sci_max, eng_max, total_max);
&nbsp;&nbsp;printf("Min %3d %3d %3d %3d\n", math_min, sci_min, eng_min, total_min);
}

22名無しさん:2009/08/02(日) 10:10:49
#include <stdio.h>

double BMI(double height, double weight) { return weight / (height * height); }

int check(double bmi) { return (bmi < 18.5)? 0: (bmi > 25)? 2: 1; }

int main(void)
{
&nbsp;&nbsp;double height, weight;

&nbsp;&nbsp;printf("input height[m] >> ");
&nbsp;&nbsp;scanf("%lf", &height);
&nbsp;&nbsp;printf("input weight[kg] >> ");
&nbsp;&nbsp;scanf("%lf", &weight);

&nbsp;&nbsp;switch (check(BMI(height, weight))) {
&nbsp;&nbsp;&nbsp;&nbsp;case 0: puts("細いです。"); break;
&nbsp;&nbsp;&nbsp;&nbsp;case 1: puts("普通です。"); break;
&nbsp;&nbsp;&nbsp;&nbsp;case 2: puts("メタボ予備軍です。"); break;
&nbsp;&nbsp;}

&nbsp;&nbsp;return 0;
}

23名無しさん:2009/08/02(日) 10:11:22
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void uranai(int day)
{
&nbsp;&nbsp;char c;
&nbsp;&nbsp;int i, j;
&nbsp;&nbsp;printf("そんなあなたのラッキーワードは [");

&nbsp;&nbsp;for (i = 0; i <= rand() % day; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;c = 'a';
&nbsp;&nbsp;&nbsp;&nbsp;for (j = 0; j < rand() % 26; j++) c++;
&nbsp;&nbsp;&nbsp;&nbsp;printf("%c", c);
&nbsp;&nbsp;}
&nbsp;&nbsp;printf("] です");
}

int main(void)
{
&nbsp;&nbsp;int day;

&nbsp;&nbsp;srand(time(NULL));

&nbsp;&nbsp;printf("input day(1 - 31) >> ");
&nbsp;&nbsp;scanf("%d", &day);

&nbsp;&nbsp;uranai(day);

&nbsp;&nbsp;return 0;
}

24名無しさん:2009/08/02(日) 10:11:43
#include <stdio.h>
#include <string.h>

void conversation(char *s)
{
&nbsp;&nbsp;char b[128];
&nbsp;&nbsp;if (s == NULL || strlen(s) < 2) { puts("ふーん"); return; }
&nbsp;&nbsp;printf("で?\n\ninput >> ", s);
&nbsp;&nbsp;scanf("%s", b);
&nbsp;&nbsp;conversation(b);
}

int main(void)
{
&nbsp;&nbsp;char str[128];

&nbsp;&nbsp;printf("が何か?\ninput >> ");
&nbsp;&nbsp;scanf("%s", str);
&nbsp;&nbsp;conversation(str);

&nbsp;&nbsp;return 0;
}

25名無しさん:2009/10/12(月) 17:40:29
#include <iostream>
using namespace std;

int main(void) {
&nbsp;&nbsp;int minute = -1;
//&nbsp;&nbsp;int charge;

&nbsp;&nbsp;cout << "通話時間(分)を入力:";
&nbsp;&nbsp;cin >> minute; // cout << minute<<endl;
&nbsp;&nbsp;try{
&nbsp;&nbsp;&nbsp;&nbsp;if(minute < 0) throw 1;
&nbsp;&nbsp;}catch(int a){
&nbsp;&nbsp;&nbsp;&nbsp;cout << "マイナスの値が入力されました!"<<endl;
&nbsp;&nbsp;&nbsp;&nbsp;return a;
&nbsp;&nbsp;}
/*
&nbsp;&nbsp;charge = minute * 10 + 1000;
&nbsp;&nbsp;if(charge>10000) charge = 10000;
&nbsp;&nbsp;cout << charge << "円"<<endl;
*/
&nbsp;&nbsp;if(minute > (10000-1000)/10) minute = (10000-1000)/10;
&nbsp;&nbsp;cout << minute*10+1000 << "円"<<endl;
&nbsp;&nbsp;return 0;
}

26名無しさん:2009/10/14(水) 15:59:50
#include <stdio.h>
int main(){
&nbsp;&nbsp;FILE *fp;
&nbsp;&nbsp;int kaiin, kingaku, siharai;
&nbsp;&nbsp;int goukei0=0, goukei1=0;
&nbsp;&nbsp;double siharai0;

&nbsp;&nbsp;fp = fopen("data03.dat", "r");
&nbsp;&nbsp;if(fp==0){puts("file open error"); return 1;}
&nbsp;&nbsp;printf("種別  購入金額(円) 支払金額(円)\n");
&nbsp;&nbsp;while(fscanf(fp, "%d %d", &kaiin, &kingaku) != EOF){
&nbsp;&nbsp;&nbsp;&nbsp;switch(kaiin){
//&nbsp;&nbsp;&nbsp;&nbsp;case 1: siharai = kingaku*0.9;&nbsp;&nbsp;&nbsp;&nbsp;// not for GCC
&nbsp;&nbsp;&nbsp;&nbsp;case 1: siharai0 = kingaku*0.9; siharai = siharai0;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;goukei0 += kingaku; goukei1 += siharai;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("会\t%8d\t%8d\n", kingaku, siharai); break;
//&nbsp;&nbsp;&nbsp;&nbsp;case 2: siharai = kingaku*0.7;&nbsp;&nbsp;&nbsp;&nbsp;// not for GCC
&nbsp;&nbsp;&nbsp;&nbsp;case 2: siharai0 = kingaku*0.7; siharai = siharai0;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;goukei0 += kingaku; goukei1 += siharai;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("特\t%8d\t%8d\n", kingaku, siharai); break;
&nbsp;&nbsp;&nbsp;&nbsp;case 3: siharai = (kingaku<15000)?kingaku:kingaku-1000;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;goukei0 += kingaku; goukei1 += siharai;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("非\t%8d\t%8d\n", kingaku, siharai); break;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;puts("--------------------------------");
&nbsp;&nbsp;printf("合計\t%8d\t%8d\n",goukei0, goukei1);
&nbsp;&nbsp;fclose(fp);
&nbsp;&nbsp;return 0;
}

27名無しさん:2009/11/10(火) 09:49:37
#include <stdio.h>
#define SIZE 5
int main(void) {
&nbsp;&nbsp;char data[SIZE+1] = "abcde";
&nbsp;&nbsp;int i1, i2, i3, i4;
&nbsp;&nbsp;for(i1=0; i1<SIZE; i1++) {
&nbsp;&nbsp;for(i2=0; i2<SIZE; i2++) {
&nbsp;&nbsp;&nbsp;&nbsp;if(i1==i2) continue;
&nbsp;&nbsp;for(i3=0; i3<SIZE; i3++) {
&nbsp;&nbsp;&nbsp;&nbsp;if(i1==i3 || i2==i3) continue;
&nbsp;&nbsp;for(i4=0; i4<SIZE; i4++) {
&nbsp;&nbsp;&nbsp;&nbsp;if(i1==i4 || i2==i4 || i3==i4) continue;
&nbsp;&nbsp;&nbsp;&nbsp;if(i1==0 && i2==3 || i2==0 && i3==3 || i3==0 && i4==3) continue; // ad
&nbsp;&nbsp;&nbsp;&nbsp;if(i1==1 && i2==3 || i2==1 && i3==3 || i3==1 && i4==3) continue; // bd
&nbsp;&nbsp;&nbsp;&nbsp;if(i1==3 && i2==4 || i2==3 && i3==4 || i3==3 && i4==4) continue; // de
&nbsp;&nbsp;&nbsp;&nbsp;printf("%c%c%c%c\n",data[i1],data[i2],data[i3],data[i4]);
&nbsp;&nbsp;} } } }
}

28名無しさん:2009/11/10(火) 20:35:39
// 課題 1
#include <stdio.h>
int main(void) {
&nbsp;&nbsp;int data, i, len; char str[21];
&nbsp;&nbsp;puts("符号なし32ビット整数を入力して下さい.");
&nbsp;&nbsp;fscanf(stdin, "%d%*c", &data);
&nbsp;&nbsp;printf("%d が格納されている先頭アドレスは 0x%08x です.\n", data, &data);
&nbsp;&nbsp;puts("20 文字以内の文字列を入力してください.");
&nbsp;&nbsp;fgets(str, sizeof str+1, stdin);
&nbsp;&nbsp;len = strlen(str)-1;
&nbsp;&nbsp;str[len] = '\0';
&nbsp;&nbsp;printf("%s が格納されている先頭アドレスは 0x%08x です.\n", str, str);
&nbsp;&nbsp;for(i = 0; i < len; i++)
&nbsp;&nbsp;&nbsp;&nbsp;printf("%c が格納されているアドレスは 0x%08x です.\n", str[i], &str[i]);
&nbsp;&nbsp;return 0;
}
// 課題 2
#include <stdio.h>
int main(void) {
&nbsp;&nbsp;int data, i, len; unsigned char *str;
&nbsp;&nbsp;puts("符号なし32ビット整数を入力して下さい.");
&nbsp;&nbsp;fscanf(stdin, "%d%*c", &data);
&nbsp;&nbsp;printf("%d が格納されている先頭アドレスは 0x%08x です.\n", data, &data);
&nbsp;&nbsp;str = (char *)&data;
&nbsp;&nbsp;for(i = 0; i < sizeof(int)/sizeof(char); i++)
&nbsp;&nbsp;&nbsp;&nbsp;printf("アドレス 0x%08x に格納されている値は %d です.\n", &str[i], str[i]);
&nbsp;&nbsp;return 0;
}

29大規模帰省中です.:2009/11/10(火) 22:47:08
>>28 unsigned int "%u"
// 課題 1
#include <stdio.h>
int main(void) {
&nbsp;&nbsp;unsigned int data; int i, o, odd=0, even=0;
&nbsp;&nbsp;puts("符号なし32bit整数を入力して下さい.");
&nbsp;&nbsp;fscanf(stdin, "%u%*c", &data);
&nbsp;&nbsp;printf("%u は2進表示で ", data);
&nbsp;&nbsp;for(i = 0; i < sizeof(int)*8; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;o = 1&(data>>(sizeof(int)*8-1-i));
&nbsp;&nbsp;&nbsp;&nbsp;printf("%d", o);
&nbsp;&nbsp;&nbsp;&nbsp;if(o) odd++; else even++;
&nbsp;&nbsp;&nbsp;&nbsp;if(!((i+1)%4)) printf(" ");
&nbsp;&nbsp;}
&nbsp;&nbsp;printf("です.\n", data);
&nbsp;&nbsp;printf("0のビット数は%d,1のビット数は%dです.", even, odd);
&nbsp;&nbsp;return 0;
}

30名無しさん:2009/11/17(火) 23:44:02
#include <stdio.h>
int main(void) {
&nbsp;&nbsp;struct kouzoutai {
&nbsp;&nbsp;&nbsp;&nbsp;unsigned long int ldata;
&nbsp;&nbsp;&nbsp;&nbsp;struct {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unsigned short int idata1, idata2;
&nbsp;&nbsp;&nbsp;&nbsp;};
&nbsp;&nbsp;} s_data;
&nbsp;&nbsp;union kyoyoutai {
&nbsp;&nbsp;&nbsp;&nbsp;unsigned long int ldata;
&nbsp;&nbsp;&nbsp;&nbsp;struct {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unsigned short int idata1, idata2;
&nbsp;&nbsp;&nbsp;&nbsp;};
&nbsp;&nbsp;} u_data;
&nbsp;&nbsp;unsigned long int data;
&nbsp;&nbsp;unsigned short int d1 = 0x1234, d2 = 0x5678;

&nbsp;&nbsp;puts("符号なし32ビット整数を入力して下さい."); scanf("%lu", &data);
&nbsp;&nbsp;printf("入力値は16進表示で %08x です.\n", data);
&nbsp;&nbsp;printf("2つの符号なし16ビット整数にそれぞれ 0x%04x, 0x%04x を代入する.\n", d1, d2);

&nbsp;&nbsp;s_data.ldata = data; s_data.idata1 = d1; s_data.idata2 = d2;
&nbsp;&nbsp;printf("符号なし32ビット整数の値は16進数表示で %08x です.\n", s_data.ldata);
&nbsp;&nbsp;printf("符号なし16ビット整数の値は16進数表示で %04x です.\n", s_data.idata1);
&nbsp;&nbsp;printf("符号なし16ビット整数の値は16進数表示で %04x です.\n", s_data.idata2);

&nbsp;&nbsp;u_data.ldata = data; u_data.idata1 = d1; u_data.idata2 = d2;
&nbsp;&nbsp;printf("符号なし32ビット整数の値は16進数表示で %08x です.\n", u_data.ldata);
&nbsp;&nbsp;printf("符号なし16ビット整数の値は16進数表示で %04x です.\n", u_data.idata1);
&nbsp;&nbsp;printf("符号なし16ビット整数の値は16進数表示で %04x です.\n", u_data.idata2);
&nbsp;&nbsp;return 0;
}

31名無しさん:2009/11/26(木) 17:33:31
#include <stdio.h>
int main(void) {
&nbsp;&nbsp;char data[20];
&nbsp;&nbsp;int i, lin, array[11];

&nbsp;&nbsp;for(i=0; i<11; i++) array[i] = 0;
&nbsp;&nbsp;puts("点数を入力してください。(終了条件:'e'あるいは'E')");
&nbsp;&nbsp;while(gets(data) != NULL) {
&nbsp;&nbsp;&nbsp;&nbsp;if(data[0] == 'E' || data[0] == 'e') break;
&nbsp;&nbsp;&nbsp;&nbsp;lin = atoi(data);
&nbsp;&nbsp;&nbsp;&nbsp;if(lin < 0 || lin > 100) continue;
&nbsp;&nbsp;&nbsp;&nbsp;array[lin / 10]++;
&nbsp;&nbsp;}
&nbsp;&nbsp;for(i=0; i<10; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;printf("%2d〜%2d点は%d人\n", i*10, i*10+9, array[i]);
&nbsp;&nbsp;}
&nbsp;&nbsp;printf("  %d点は%d人\n", i*10, array[i]);
&nbsp;&nbsp;return 0;
}

32名無しさん:2009/12/02(水) 14:23:37
#include <stdio.h>

/* 要素数がnoであるint型の配列v2の並びを逆順にしたものを配列v1に格納する関数 */
void intary_rcpy(int v1[], const int v2[], int no)
{
&nbsp;&nbsp;int i;

&nbsp;&nbsp;for(i=0; i<no; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;v1[no-i-1] = v2[i];
&nbsp;&nbsp;}
}
int main(void) {
&nbsp;&nbsp;int a[10]={1,3,5,7,9,11,13,15,17,19};
&nbsp;&nbsp;int b[10], n=10, i;

&nbsp;&nbsp;for(i=0; i<n; i++) printf("%d ", a[i]);
&nbsp;&nbsp;intary_rcpy(b, a, n);
&nbsp;&nbsp;puts("");
&nbsp;&nbsp;for(i=0; i<n; i++) printf("%d ", b[i]);
&nbsp;&nbsp;return 0;
}

33名無しさん:2009/12/15(火) 17:32:18
#include <stdio.h>
#include <mbstring.h>

int main(void) {
&nbsp;&nbsp;unsigned int a, b;
&nbsp;&nbsp;unsigned char buf[100];
&nbsp;&nbsp;unsigned char *cptr = buf;

&nbsp;&nbsp;printf("全角文字の文字列を入力:");
&nbsp;&nbsp;fgets(buf, 100, stdin);
&nbsp;&nbsp;puts("SJIS JIS");
&nbsp;&nbsp;while(cptr[0] != '\0' && cptr[1] != '\0') {
&nbsp;&nbsp;&nbsp;&nbsp;a = cptr[0]<<8 | cptr[1];
&nbsp;&nbsp;&nbsp;&nbsp;printf("%04X ", a);
&nbsp;&nbsp;&nbsp;&nbsp;b = _mbcjmstojis( a );
&nbsp;&nbsp;&nbsp;&nbsp;printf("%04X\n", b);
&nbsp;&nbsp;&nbsp;&nbsp;cptr += 2;
&nbsp;&nbsp;}
&nbsp;&nbsp;return 0;
}

34名無しさん:2009/12/20(日) 13:56:30
// 必修課題1
#include <stdio.h>
int main(void) {
&nbsp;&nbsp;int i, total;

&nbsp;&nbsp;i=(32+1)/2; printf("答えは%dです。\n", (32+1)*i*3 + 99);

&nbsp;&nbsp;for(total=0, i=1; i<=99/3; i++) total += i*3;
&nbsp;&nbsp;return printf("答えは%dです。\n", total);
}

35名無しさん:2009/12/21(月) 09:08:47
#include <stdio.h>
int main(void) {
&nbsp;&nbsp;int num, i, data, max=0x80000000; /* 32 bit int */
&nbsp;&nbsp;char *buf;

&nbsp;&nbsp;buf = (char *)calloc(1000, sizeof(char));
&nbsp;&nbsp;if(!buf) return 1;
&nbsp;&nbsp;printf("Input a numer of count. >"); scanf("%d%*c", &num);
&nbsp;&nbsp;if(num <= 0) { printf("正の整数ではありません\n"); return 2; }
&nbsp;&nbsp;for(i=0; i<num; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;printf("[%d] = ", i+1);
&nbsp;&nbsp;&nbsp;&nbsp;if(scanf("%d", &data) != 1) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fgets(buf, 1000, stdin);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i--;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;if(data > max) max = data;
&nbsp;&nbsp;}
&nbsp;&nbsp;free(buf);
&nbsp;&nbsp;return printf("\nmax number is %d.", max);
}

36名無しさん:2009/12/26(土) 07:15:26
// Part133_442 問題2
#include <stdio.h>
#include <malloc.h>
int main(void){
&nbsp;&nbsp;int i, j, n, m;
&nbsp;&nbsp;float *a, *b;

&nbsp;&nbsp;printf("n:"); scanf("%d", &n);
&nbsp;&nbsp;printf("m:"); scanf("%d", &m);
&nbsp;&nbsp;a = (float*)malloc(sizeof(float)*m*n); if(!a) return 1;
&nbsp;&nbsp;b = (float*)malloc(sizeof(float)*m*n); if(!b) {free(a); return 1;}
&nbsp;&nbsp;for(i=0;i<n;i++) for(j=0;j<m;j++){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("a[%d][%d]=",i,j); scanf("%f", a+i*m+j);}
&nbsp;&nbsp;for(i=0;i<n;i++) for(j=0;j<m;j++){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("b[%d][%d]=",i,j); scanf("%f", b+i*m+j);}
&nbsp;&nbsp;printf("\na=");
&nbsp;&nbsp;for(i=0;i<n;i++){
&nbsp;&nbsp;&nbsp;&nbsp;for(j=0;j<m;j++) printf("\t%.2f", *(a+i*m+j));
&nbsp;&nbsp;&nbsp;&nbsp;printf("\n");
&nbsp;&nbsp;}
&nbsp;&nbsp;printf("\nb=");
&nbsp;&nbsp;for(i=0;i<n;i++){
&nbsp;&nbsp;&nbsp;&nbsp;for(j=0;j<m;j++) printf("\t%.2f", *(b+i*m+j));
&nbsp;&nbsp;&nbsp;&nbsp;printf("\n");
&nbsp;&nbsp;}
&nbsp;&nbsp;printf("\nc=");
&nbsp;&nbsp;for(i=0;i<n;i++){
&nbsp;&nbsp;&nbsp;&nbsp;for(j=0;j<m;j++) printf("\t%.2f", *(a+i*m+j) + *(b+i*m+j));
&nbsp;&nbsp;&nbsp;&nbsp;printf("\n");
&nbsp;&nbsp;}
&nbsp;&nbsp;free(b); free(a);
&nbsp;&nbsp;return 0;
}

37名無しさん:2010/01/10(日) 10:31:32
#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#define LEN 20
int main(void){
&nbsp;&nbsp;char s[5][LEN+1], ans[21], *p;
&nbsp;&nbsp;int i, count=0, t[10], b, len;

&nbsp;&nbsp;printf("%d文学までの問題文を五⊃入れてください\n", LEN);
&nbsp;&nbsp;for(i=0; i<5; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;printf("%d⊃目の問題文:", i+1);
&nbsp;&nbsp;&nbsp;&nbsp;fgets(s[i], LEN+1, stdin);
&nbsp;&nbsp;&nbsp;&nbsp;fflush(stdin);
&nbsp;&nbsp;&nbsp;&nbsp;len = strlen(s[i]);
&nbsp;&nbsp;&nbsp;&nbsp;if(s[i][len-1] == '\n') s[i][len-1] = '\0';
&nbsp;&nbsp;}
&nbsp;&nbsp;for(i=0; i<10; i++) t[i] = i/2; // 0,0,1,1,2,2,3,3,4,4
&nbsp;&nbsp;for(i=0; i<10; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;b = rand()%(10-i);
//&nbsp;&nbsp;&nbsp;&nbsp;printf("%d %d ", b, t[b]); // 出題されない問題は無い。
&nbsp;&nbsp;&nbsp;&nbsp;p = s[t[b]];
&nbsp;&nbsp;&nbsp;&nbsp;t[b] = t[10-i];
&nbsp;&nbsp;&nbsp;&nbsp;printf("問題:%s\n錬習:", p);
&nbsp;&nbsp;&nbsp;&nbsp;fgets(ans, LEN+1, stdin);
&nbsp;&nbsp;&nbsp;&nbsp;fflush(stdin);
&nbsp;&nbsp;&nbsp;&nbsp;if( strcmp(p, ans) ) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts("不正解");
&nbsp;&nbsp;&nbsp;&nbsp;} else {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts("正解!!");
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count++;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;puts("*******************");
&nbsp;&nbsp;printf("正解数:%d\n",count);
&nbsp;&nbsp;return 0;
}

38>>37の修正:2010/01/10(日) 10:48:05
#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#define LEN 20
int main(void){
&nbsp;&nbsp;char s[5][LEN+1], ans[21], *p;
&nbsp;&nbsp;int i, count=0, t[10], b, len;

&nbsp;&nbsp;printf("%d文学までの問題文を五⊃入れてください\n", LEN);
&nbsp;&nbsp;for(i=0; i<5; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;printf("%d⊃目の問題文:", i+1);
&nbsp;&nbsp;&nbsp;&nbsp;fgets(s[i], LEN+1, stdin);
&nbsp;&nbsp;&nbsp;&nbsp;fflush(stdin);
&nbsp;&nbsp;&nbsp;&nbsp;len = strlen(s[i]);
&nbsp;&nbsp;&nbsp;&nbsp;if(s[i][len-1] == '\n') s[i][len-1] = '\0';
&nbsp;&nbsp;}
&nbsp;&nbsp;for(i=0; i<10; i++) t[i] = i/2; // 0,0,1,1,2,2,3,3,4,4
&nbsp;&nbsp;for(i=0; i<10; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;b = rand()%(10-i);
//&nbsp;&nbsp;&nbsp;&nbsp;printf("%d %d ", b, t[b]); // 出題されない問題は無い。
&nbsp;&nbsp;&nbsp;&nbsp;p = s[t[b]];
&nbsp;&nbsp;&nbsp;&nbsp;t[b] = t[10-i];
&nbsp;&nbsp;&nbsp;&nbsp;printf("問題:%s\n錬習:", p);
&nbsp;&nbsp;&nbsp;&nbsp;fgets(ans, LEN+1, stdin);
&nbsp;&nbsp;&nbsp;&nbsp;fflush(stdin);
&nbsp;&nbsp;&nbsp;&nbsp;len = strlen(ans);
&nbsp;&nbsp;&nbsp;&nbsp;if(ans[len-1] == '\n') ans[len-1] = '\0';
&nbsp;&nbsp;&nbsp;&nbsp;if( strcmp(p, ans) ) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts("不正解");
&nbsp;&nbsp;&nbsp;&nbsp;} else {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts("正解!!");
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count++;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;puts("*******************");
&nbsp;&nbsp;printf("正解数:%d\n",count);
&nbsp;&nbsp;return 0;
}

39これも>>37の修正:2010/01/10(日) 10:56:05
#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#define LEN 20
int main(void){
&nbsp;&nbsp;char s[5][LEN+2], ans[21], *p;
&nbsp;&nbsp;int i, count=0, t[10], b, len;

&nbsp;&nbsp;printf("%d文学までの問題文を五⊃入れてください\n", LEN);
&nbsp;&nbsp;for(i=0; i<5; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;printf("%d⊃目の問題文:", i+1);
&nbsp;&nbsp;&nbsp;&nbsp;fgets(s[i], LEN+2, stdin);
&nbsp;&nbsp;&nbsp;&nbsp;fflush(stdin);
&nbsp;&nbsp;&nbsp;&nbsp;len = strlen(s[i]);
&nbsp;&nbsp;&nbsp;&nbsp;/*if(s[i][len-1] == '\n')*/ s[i][len-1] = '\0';
&nbsp;&nbsp;}
&nbsp;&nbsp;for(i=0; i<10; i++) t[i] = i/2; // 0,0,1,1,2,2,3,3,4,4
&nbsp;&nbsp;for(i=0; i<10; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;b = rand()%(10-i);
//&nbsp;&nbsp;&nbsp;&nbsp;printf("%d %d ", b, t[b]); // 出題されない問題は無い。
&nbsp;&nbsp;&nbsp;&nbsp;p = s[t[b]];
&nbsp;&nbsp;&nbsp;&nbsp;t[b] = t[10-i];
&nbsp;&nbsp;&nbsp;&nbsp;printf("問題:%s\n錬習:", p);
&nbsp;&nbsp;&nbsp;&nbsp;fgets(ans, LEN+2, stdin);
&nbsp;&nbsp;&nbsp;&nbsp;fflush(stdin);
&nbsp;&nbsp;&nbsp;&nbsp;len = strlen(ans);
&nbsp;&nbsp;&nbsp;&nbsp;/*if(ans[len-1] == '\n')*/ ans[len-1] = '\0';
&nbsp;&nbsp;&nbsp;&nbsp;if( strcmp(p, ans) ) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts("不正解");
&nbsp;&nbsp;&nbsp;&nbsp;} else {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts("正解!!");
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count++;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;puts("*******************");
&nbsp;&nbsp;printf("正解数:%d\n",count);
&nbsp;&nbsp;return 0;
}

40>>39の修正:2010/01/10(日) 11:06:51
#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#define LEN 20
int main(void){
&nbsp;&nbsp;char s[5][LEN+2], ans[LEN+2], *p;
&nbsp;&nbsp;int i, count=0, t[10], b, len;

&nbsp;&nbsp;printf("%d文学までの問題文を五⊃入れてください\n", LEN);
&nbsp;&nbsp;for(i=0; i<5; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;printf("%d⊃目の問題文:", i+1);
&nbsp;&nbsp;&nbsp;&nbsp;fgets(s[i], LEN+2, stdin);
&nbsp;&nbsp;&nbsp;&nbsp;fflush(stdin);
&nbsp;&nbsp;&nbsp;&nbsp;len = strlen(s[i]);
&nbsp;&nbsp;&nbsp;&nbsp;/*if(s[i][len-1] == '\n')*/ s[i][len-1] = '\0';
&nbsp;&nbsp;}
&nbsp;&nbsp;for(i=0; i<10; i++) t[i] = i/2; // 0,0,1,1,2,2,3,3,4,4
&nbsp;&nbsp;for(i=0; i<10; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;b = rand()%(10-i);
//&nbsp;&nbsp;&nbsp;&nbsp;printf("%d %d ", b, t[b]); // 出題されない問題は無い。
&nbsp;&nbsp;&nbsp;&nbsp;p = s[t[b]];
&nbsp;&nbsp;&nbsp;&nbsp;t[b] = t[10-i];
&nbsp;&nbsp;&nbsp;&nbsp;printf("問題:%s\n錬習:", p);
&nbsp;&nbsp;&nbsp;&nbsp;fgets(ans, LEN+2, stdin);
&nbsp;&nbsp;&nbsp;&nbsp;fflush(stdin);
&nbsp;&nbsp;&nbsp;&nbsp;len = strlen(ans);
&nbsp;&nbsp;&nbsp;&nbsp;/*if(ans[len-1] == '\n')*/ ans[len-1] = '\0';
&nbsp;&nbsp;&nbsp;&nbsp;if( strcmp(p, ans) ) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts("不正解");
&nbsp;&nbsp;&nbsp;&nbsp;} else {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts("正解!!");
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count++;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;puts("*******************");
&nbsp;&nbsp;printf("正解数:%d\n",count);
&nbsp;&nbsp;return 0;
}

41945:2010/03/21(日) 15:59:06
またエラーなりました。ここで前書き込みをいしたらいつの間にかちゃんと投稿されていました。今回はどうすればいいのかわかりませんので、またここ「ろだ」に書かせてもらいます。
名前: 945
E-mail:
内容:
945です。
皆様、お返事ありがとうございました!この前書き込みしたときにエラーになってしまったので、書き込みできていないと思っていたらで今日またベアストウで検索したら自分のがでてきました!!本当に申し訳ありませんでした。
ワードファイルの件、申し訳ありませんでした。何がなんだかわからないのでベアストウ法でコードを見つけてはコピペしておりました。
>>948
ありがとうございます!
とりあえず他の方の作ったやつで.exeファイルをつくってみました。
Excelのやつは一番理想的ですがさどうしません。EmailもZipに入っています。
http://kansai2channeler.hp.infoseek.co.jp/cgi-bin/joyful/img/10561.zip

42名無しさん:2010/11/22(月) 15:02:00
// Part143_273-1
#include <cstdio>
using namespace std;
int main() {
&nbsp;&nbsp;char c;
&nbsp;&nbsp;int char_count, num_count, up_count;
&nbsp;&nbsp;int low_count, space_count, other_count;
while(true){
&nbsp;&nbsp;char_count = num_count = up_count =
&nbsp;&nbsp;low_count = space_count = other_count = 0;
&nbsp;&nbsp;while((c = getchar()) != '\n') { /* DATA 入力 */
&nbsp;&nbsp;&nbsp;&nbsp;char_count++;
&nbsp;&nbsp;&nbsp;&nbsp;if('0' <= c && c <= '9')
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;num_count++;
&nbsp;&nbsp;&nbsp;&nbsp;else if('A' <= c && c <= 'Z')
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;up_count++;
&nbsp;&nbsp;&nbsp;&nbsp;else if('a' <= c && c <= 'z')
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;low_count++;
&nbsp;&nbsp;&nbsp;&nbsp;else if(c == ' ')
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;space_count++;
&nbsp;&nbsp;&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;other_count++;
&nbsp;&nbsp;}
&nbsp;&nbsp;printf("全文字 : %d\n", char_count); /* DATA 出力 */
&nbsp;&nbsp;printf("数字 : %d\n", num_count);
&nbsp;&nbsp;printf("英大文字 : %d\n", up_count);
&nbsp;&nbsp;printf("英小文字 : %d\n", low_count);
&nbsp;&nbsp;printf("空白 : %d\n", space_count);
&nbsp;&nbsp;printf("その他 : %d\n", other_count);
}}

43名無しさん:2010/11/22(月) 15:02:31
// Part143_273-2
#include <cstdio>
using namespace std;
int main() {
const int row = 4, col = 3;
&nbsp;&nbsp;int i, j, A[row][col];
while(true) {
&nbsp;&nbsp;for(i = 0; i < row; i++) /* DATA 入力 */
&nbsp;&nbsp;&nbsp;&nbsp;for(j = 0; j < col; j++) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("[%d,%d] = ", i + 1, j + 1);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scanf("%d", &A[i][j]);
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;printf(" "); /* DATA 出力 */
&nbsp;&nbsp;for(i = 0; i < col; i++)
&nbsp;&nbsp;&nbsp;&nbsp;printf(" Column%d", i + 1);
&nbsp;&nbsp;puts("\n------------------------------------");
&nbsp;&nbsp;for(i = 0; i < row; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;printf("Row%d :", i + 1);
&nbsp;&nbsp;&nbsp;&nbsp;for(j = 0; j < col; j++)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(" %9d", A[i][j] * 3);
&nbsp;&nbsp;&nbsp;&nbsp;puts("");
&nbsp;&nbsp;}
}}

44名無しさん:2010/12/10(金) 13:27:52
// Part144_281
#include <stdio.h>
void sub1(float x, float y, float z, float *r)
{
&nbsp;&nbsp;*r = x*x + y*y + z*z;
}
float fun1(float x, float y, float z)
{
&nbsp;&nbsp;return x*x + y*y + z*z;
}
int main(void){
&nbsp;&nbsp;float x=2., y=3., z=4., r;
&nbsp;&nbsp;sub1(x, y, z, &r);
&nbsp;&nbsp;printf("%f\n", r);
&nbsp;&nbsp;r = fun1(x, y, z);
&nbsp;&nbsp;printf("%f\n", r);
}

45Part159_109:2012/08/05(日) 12:30:15
#include <stdio.h>

typedef struct {&nbsp;&nbsp;// 2倍長整数を定義する型
&nbsp;&nbsp;int&nbsp;&nbsp;&nbsp;&nbsp;flag;&nbsp;&nbsp;// 0:負、1:正
&nbsp;&nbsp;unsigned int&nbsp;&nbsp;upper;&nbsp;&nbsp;// 上位ワード
&nbsp;&nbsp;unsigned int&nbsp;&nbsp;lower;&nbsp;&nbsp;// 下位ワード
} w_int;

void DivFunc(w_int* pNumA, w_int* pNumB)&nbsp;&nbsp;// 2倍長整数同士の除算 (A÷B)
{
&nbsp;&nbsp;w_int&nbsp;&nbsp;q, r;&nbsp;&nbsp;// q:除算結果 r:余り
&nbsp;&nbsp;int&nbsp;&nbsp;i;

&nbsp;&nbsp;if (pNumB->upper == 0 && pNumB->lower == 0) return;&nbsp;&nbsp;// 分母が0なら終了。
&nbsp;&nbsp;q.upper = q.lower = 0;&nbsp;&nbsp;// 除算結果に0をセットする
&nbsp;&nbsp;r.upper = r.lower = 0;&nbsp;&nbsp;// 余りに0をセットする
&nbsp;&nbsp;for (i = 63; 0 <= i; i--) {&nbsp;&nbsp;// 桁の大きい方から小さいほうに向かって計算する。
&nbsp;&nbsp;&nbsp;&nbsp;r.upper <<= 1;&nbsp;&nbsp;// 余りの上位ワードのみ、除算結果を2倍にする
&nbsp;&nbsp;&nbsp;&nbsp;r.upper |= r.lower >> 31;&nbsp;&nbsp;// 余りの下位ワードの最上位ビットを、上位ワードの最下位ビットにコピー
&nbsp;&nbsp;&nbsp;&nbsp;r.lower <<= 1;&nbsp;&nbsp;// 余りの下位ワードのみ、除算結果を2倍にする
&nbsp;&nbsp;&nbsp;&nbsp;// 分子の、注目するビット位置の値が1なら、余りの下位ワードに1をセットする。(??)
&nbsp;&nbsp;&nbsp;&nbsp;if (32 <= i) {&nbsp;&nbsp;// 上位ワードの計算なら
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;r.lower |= (pNumA->upper >> (i - 32)) & 1;
&nbsp;&nbsp;&nbsp;&nbsp;} else {&nbsp;&nbsp;&nbsp;&nbsp;// 下位ワードの計算なら
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;r.lower |= (pNumA->lower >> i) & 1;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;if (r.upper < pNumB->upper) continue;
&nbsp;&nbsp;&nbsp;&nbsp;if (r.upper == pNumB->upper && r.lower < pNumB->lower) continue;
&nbsp;&nbsp;&nbsp;&nbsp;// ↑余りが分母の値より小さいなら、ループ内で以下の処理は行わない。(除算結果と余りを変更しない)
&nbsp;&nbsp;&nbsp;&nbsp;r.upper -= pNumB->upper;&nbsp;&nbsp;// 余りの上位ワードから、分母の上位ワードを減算する
&nbsp;&nbsp;&nbsp;&nbsp;if (r.lower < pNumB->lower) r.upper--;&nbsp;&nbsp;// 余りの下位ワードが、分母の下位ワードより小さいなら、
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 余りの上位ワードから1を引く。
&nbsp;&nbsp;&nbsp;&nbsp;r.lower -= pNumB->lower;&nbsp;&nbsp;// 余りの下位ワードから、分母の下位ワードを減算する
&nbsp;&nbsp;&nbsp;&nbsp;// 除算結果の、注目するビット位置に1をセットする。
&nbsp;&nbsp;&nbsp;&nbsp;if (32 <= i) {&nbsp;&nbsp;// 上位ワードの計算なら
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;q.upper |= 1 << (i - 32);
&nbsp;&nbsp;&nbsp;&nbsp;} else {&nbsp;&nbsp;&nbsp;&nbsp;// 下位ワードの計算なら
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;q.lower |= 1 << i;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;q.flag = !(!pNumA->flag ^ !pNumB->flag);&nbsp;&nbsp;// 除算結果の符号は、AとBどちらか一方が負なら―
&nbsp;&nbsp;r.flag = 1;&nbsp;&nbsp;&nbsp;&nbsp;// 余りの符号は+
&nbsp;&nbsp;*pNumA = q;&nbsp;&nbsp;&nbsp;&nbsp;// Aに除算結果をコピーする
&nbsp;&nbsp;*pNumB = r;&nbsp;&nbsp;&nbsp;&nbsp;// Bに余りをコピーする
}

49アグ アウトレット:2013/10/29(火) 07:29:28
Hence, increasingly, they kept clear with Ian, knowing that if many people dared to broach wounds (particularly insoluble ones!) they would incur his or her wrath. It didn take Ian longer to realise that the direct reports were failing to offer results and he became exceedingly frustrated in regards to the lack of progress. Naturally he remonstrated with them, explaining over and more than again the importance associated with proposing solutions. what you paid pertaining to to spot challenges in addition to produce SOLUTIONS! But it was in order to no avail. The more Ian fretted, the more his one on one reports took fright and suffered from solution paralysis. Eventually, Ian called a crisis meeting and demanded a conclusion. the problem? he shrieked, slamming his fist down within the table. But his direct accounts, flabbergasted to hear Ian while using the P word, couldn bring themselves to tell him that the dilemma was him! Advice to Ian.
アグ アウトレット http://www.shyaammusic.com/

50chloe 財布:2013/11/01(金) 22:09:44
I always spent my half an hour to read this blog’s articles or reviews every day along with a mug of coffee.
chloe 財布 http://www.myindyareahome.com/

51名無しさん:2020/01/16(木) 13:42:42
ゆげ塾 世界史 事件 低迷 経営危機

52名無しさん:2020/01/16(木) 13:43:29
ゆげ塾 世界史 事件 低迷 経営危機

53名無しさん:2020/01/16(木) 13:45:02
ゆげ塾 世界史 事件 低迷 経営危機

54名無しさん:2020/01/16(木) 13:45:58
ゆげ塾 世界史 事件 低迷 経営危機


新着レスの表示


名前: E-mail(省略可)

※書き込む際の注意事項はこちら

※画像アップローダーはこちら

(画像を表示できるのは「画像リンクのサムネイル表示」がオンの掲示板に限ります)

掲示板管理者へ連絡 無料レンタル掲示板