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

test

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

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(省略可)

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

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

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

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