//任务一 2015015391 宫梦南 #include #define PI 3.1415926 void main() { float s,r; gotoxy(10,10); printf("please input your circle r:"); scanf("%f",&r); s=PI*r*r; gotoxy(10,14); printf("THIS CIRCLE S:%f",s); getch(); } //任务二 2015015391 宫梦南 #include <stdio.h> int main(void) { int m,n,sum; printf("请输入两个整数\n"); scanf("%d,%d",&a,&b); sum=m+n; if(sum%10==0){ printf("是好朋友数\n"); } else{ printf("不是好朋友数\n"); } return 0; } //任务三 2015015391 宫梦南 #include < stdio.h> #include < stdlib.h> #define MAXNUMBER 100 typedef struct SeqStack { int data[MAXNUMBER]; int top; }SeqStack; SeqStack *SeqStackInit (SeqStack *s) { s->top = -1; return s; } void SeqStackPush(SeqStack *s, int x) { if(s->top == MAXNUMBER -1) printf("Seqstack is full!\n"); s->top++; s->data[s->top] = x; } int SeqStackPop(SeqStack *s) { //if(s->top == -1) //printf("Seqstack is empty\n"); int x; x = s->data[s->top]; s->top--; return x; } void ConverseTo8(int n) { SeqStack *stack; stack = SeqStackInit(stack); while(n) { SeqStackPush(stack, n % 8); n = n / 8; } while(stack->top != -1) { int y = SeqStackPop(stack); printf("%d", y); } } void ConverseTo16(int n) { SeqStack *stack; stack = SeqStackInit(stack); while(n!=0) { SeqStackPush(stack, n % 16); n = n / 16; } while(stack->top != -1) { int y = SeqStackPop(stack); if(y<10) printf("%d", y); else printf("%c", y - 10 + 'A'); } } int main() { printf("Please input a decimal number: "); int x; scanf("%d", &x); printf("The octal number is: "); ConverseTo8(x); printf("\n"); printf("The hexadecimal number is: "); ConverseTo16(x); printf("\n"); return 0; }
任务二 :理解数据类型、掌握运算符及表达式使用
3
分
任务尚未发布或者你没有权限查看任务内容。
任务讨论