
作业社区
探索学习新天地,共享知识资源!
慕粉8395673 的学生作业:
#include int main() { int a = 0, b = 0; printf("please input 2 number: "); scanf("%d %d", &a,&b); printf(" a < b = %d\n", a < b); printf(" a > b = %d\n", a > b); printf(" a != b = %d\n", a !=b); printf("=============================== "); return 0; }





daishuuuu 的学生作业:
# myadd.c int myadd(int a, int b) { return (a+b); } # myadd.h #ifndef __MY_ADD_H_ #define __MY_ADD_H_ extern int myadd(int a, int b); #endif #include #include "myadd.h" int main(void) { int a = 10; int b = 20; int c = myadd(a, b); printf("result is %d \n", c); return 0; } gcc -c myadd.c -o myadd.o gcc -shared myadd.o -o libfile.so gcc -I. -L. -lmyadd main.c -o main export LD_LIBRARY_PATH=.





满足各态历经性的XC 的学生作业:
#ifndef COMMON_H #define COMMON_H typedef char BYTE; typedef int INT; typedef short SHORT; typedef unsigned char WORD8; typedef unsigned short WORD16; typedef unsigned int WORD32; #endif // COMMON_H #ifndef CHESS_H #define CHESS_H #include “common.h” #include #include #include class Chess { private: INT x; INT y; std::string color; public: Chess(const std::string &color, INT x, INT y) : x(x), y(y), color(color) {} INT getx() const { return x; } INT gety() const; std::string getColor() const { return color; } virtual void show() const = 0; ~Chess(); }; Chess::~Chess() { } INT Chess::gety() const { return y; } #endif // CHESS_H #ifndef BLACK_CHESS_H #define BLACK_CHESS_H #include “common.h” #include “chess.h” #include class BlockChess : public Chess { public: BlockChess(INT x, INT y) : Chess(“black”, x, y) {} void show() const override; }; void BlockChess::show() const { fprintf(stderr, “\033[%d;%dH\033[43;35m[☻]\033[0m”, gety(), getx() - 1); fprintf(stderr, “\033[%d;%dH”, gety() + 1, getx()); } #endif // BLACK_CHESS_H #ifndef WHITE_CHESS_H #define WHITE_CHESS_H #include “common.h” #include “chess.h” #include class WhitekChess : public Chess { public: WhitekChess(INT x, INT y) : Chess(“black”, x, y) {} void show() const override; }; void WhitekChess::show() const { fprintf(stderr, “\033[%d;%dH\033[44;35m[☺]\033[0m”, gety(), getx() - 1); fprintf(stderr, “\033[%d;%dH”, gety() + 1, getx()); } #endif // BLACK_CHESS_H #include “blackchess.h” #include “whitechess.h” #include INT main() { BlockChess b(3, 4); WhitekChess w(6, 5); b.show(); w.show(); return 0; }