c
HelloWorld. py
后端敲门人
展开
-
图形变换——变速移动
#include <GL/glut.h>#include <iostream>using namespace std;#include <stdlib.h>GLfloat rtri = 0.0; //金字塔旋转角度GLfloat speed = 0.0;GLfloat WYDistance = -5.0;GLfloat level = -1.0;void init(void){ glClearColor(0.0f, 0.0f, 0.0f.原创 2021-03-17 23:51:26 · 266 阅读 · 0 评论 -
DDA算法—通用
#include <GL/glut.h>#include <iostream>using namespace std;int size;int color;void LineDDA(int x0, int y0, int x1, int y1){ int x, dx, dy, y; float m; dx = x1 - x0; dy = y1 - y0; m = dy / dx; y = y0; switch (c.原创 2021-03-17 23:43:32 · 467 阅读 · 0 评论 -
DDA算法
#include <GL/glut.h>void LineDDA(int x0, int y0, int x1, int y1){ int x, dx, dy, y; float m; dx = x1 - x0; dy = y1 - y0; m = dy / dx; y = y0; glColor3f(1.0f, 1.0f, 0.0f); glPointSize(1); for (x = x0; x <= x1;.原创 2021-03-17 23:41:29 · 489 阅读 · 0 评论 -
旋转菱形——通用
#include <GL/glut.h>#include <iostream>using namespace std;int number;#include <math.h>static int day = 200;void myDisplay(){ double x, y, PI = 3.1415926, m, n; m = 1.0 / number; n = 360.0 / number; cout << n.原创 2021-03-17 23:37:56 · 584 阅读 · 0 评论 -
45度旋转菱形
#include <GL/glut.h>#include <iostream>using namespace std;#include <math.h>static int day = 200;void myDisplay(void){ double x, y, PI = 3.1415926; x = sin(0.125 * PI) / 2; y = cos(0.125 * PI) / 2; cout << x &.原创 2021-03-17 23:33:29 · 419 阅读 · 0 评论 -
正方形的叠加
#include <GL/glut.h>void myDisplay(void){ glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_POLYGON); glVertex2f(-0.5, 0.5); glVertex2f(0.5, 0.5); glVertex2f(0.5, -0.5); glVertex2f(-0.5, -0.5).原创 2021-03-17 23:31:26 · 501 阅读 · 0 评论 -
圆,五角星和三角形
#include <GL/glut.h>#include <math.h>void myDisplay(void){ glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_TRIANGLES); glColor3f(0.0, 1.0, 0.0); glVertex2f(-1.0, 1.0); glColor3f(1.0, 1.0,.原创 2021-03-16 08:18:56 · 664 阅读 · 0 评论 -
画正方形,三角形并填入颜色
#include <GL/glut.h>void myDisplay(void){ glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_POLYGON); glColor3f(1.0f, 1.0f, 0.0f); glVertex2f(-0.5, 0.5); glVertex2f(-0.5, -0.5); glVertex2f(0.5.原创 2021-03-16 08:16:27 · 475 阅读 · 0 评论 -
OPRNGL点,线,图形函数及其他函数
glClearColor(0.0, 0.0, 0.0, 0.0);glClear(GL_COLOR_BUFFER_BIT);清屏画多边形glBegin(GL_POLYGON);glVertex2f(______) 输各个顶点坐标glEnd();画三角形glBegin(GL_TRIANGLES)glEnd();画点 glBegin(GL_POINTS...原创 2021-03-16 08:14:52 · 571 阅读 · 0 评论 -
线段交点问题
#include <iostream>using namespace std;#include <math.h>int main(){ double A_x, A_y, B_x, B_y, C_x, C_y, D_x, D_y; cout << "Please input A_x,A_y" << endl; cin >> A_x >> A_y; cout << "Please inp.原创 2021-03-16 08:12:23 · 217 阅读 · 0 评论 -
3*4井字棋
小的时候大家一定玩过“井”字棋吧。也就是在九宫格中,只要任意行、列,或者任意连续对角线上面出现三个相同的,就能获胜。现在小明和小花也在玩三子棋,但是他们不是在九宫格里,而是在3×4的格子里面。现在小明先下,但是他知道小花这个人很聪明,他想知道第一步下在哪一个地方最合适,你能帮帮他吗?Input第一行输入一个整数T,表示数据组数(1<T<10000);第二行输入两个整数x,y,表示3×4格子里面的一个坐标(x,y)(1<=x<=3,1<=y<=4);...原创 2021-03-16 08:09:50 · 438 阅读 · 0 评论 -
语法分析
#include <iostream>using namespace std;#include <string.h>char str[1000];int num, k = 0, f = 0, now, ago; //f记录:=的个数,k记录;的个数,出现关键字begin和多字节id时借用now移动指针int T = 0, Go = 1, L = 0, R = 0, Z = 1; //T来判断检索方向 T=0正向检索,T=1反向检索 Go 出现报错后终止程序.原创 2021-03-16 08:08:04 · 217 阅读 · 0 评论 -
词法分析(编译原理)
#include <iostream>using namespace std;#include <string.h>char M[1000], Gjz[6][10] = {"begin", "if", "then", "while", "do", "end"};void Set(){ char T[50]; int i, j, now; i = now = 0; while (1) { switch (M[now]).原创 2021-03-16 08:05:47 · 300 阅读 · 0 评论 -
PI值问题(cout的输出格式)
#include <iostream>#include <iomanip>using namespace std;#include <math.h>void Seriessummation(int n, int j){ int i, k; double ans = 0.0, m, pi, P; pi = acos(-1); for (i = 1, k = 1; k <= n; i += j) { m.原创 2021-03-16 08:03:55 · 576 阅读 · 0 评论 -
kmp+
#include<iostream>usingnamespacestd;typedefstruct{charch[1000];intlength;}SString;voidget_next(SStringT,intnext[]){inti=1,j=0;next[1]=0;cout<<"选择next[],请按1;选择nextval,请按2:";...原创 2021-03-16 08:02:19 · 195 阅读 · 0 评论 -
KMP算法
#include <iostream>using namespace std;#define MAXSIZE 255typedef struct{ char ch[MAXSIZE + 1]; int length;} SString;void get_next(SString T, int next[]){ int i = 1, j = 0; next[1] = 0; while (i < T.length) { .原创 2021-03-14 20:44:03 · 210 阅读 · 0 评论 -
多项式求值(优化版)
#include <iostream>using namespace std;typedef struct MNode{ int data; struct MNode *next;} MNode, *MathStack;typedef struct CNode{ char data; struct CNode *next;} CNode, *CharStack;int Switch(char e){ if ((e - 48) >=.原创 2021-03-14 20:42:23 · 289 阅读 · 0 评论 -
多项式求值
#include<iostream>using namespace std;typedef struct MNode{ int data; struct MNode *next;}MNode,*MathStack;typedef struct CNode{ char data; struct CNode *next;}CNode,*CharStack;int Switch(char e){ if((e-48)>=0&&(57-e)<=9) .原创 2021-03-14 20:40:32 · 204 阅读 · 0 评论 -
舞伴配对
#include <iostream>#include <string.h>#define MAXSIZE 10000int i = 0;using namespace std;typedef struct{ char name[20]; char sex;} Dancers;typedef struct{ Dancers *base; int front; int rear;} SqQueue;void EnDance.原创 2021-03-14 20:38:54 · 357 阅读 · 0 评论 -
图书管理系统
#include <iostream>#include <string.h>using namespace std;typedef struct Book{ char ISBN[20]; char name[50]; float cost;} Book;typedef struct LNode{ struct Book dater; struct LNode *next;} LNode, *LinkList;void Inp.原创 2021-03-14 20:35:11 · 204 阅读 · 0 评论 -
多项式运算
#include <iostream>using namespace std;typedef struct LNode{ float x; int z; struct LNode *next;} LNode, *LinkList;void Input(LinkList &Head){ Head = new LNode; Head->next = NULL; LinkList r, p; int i, n; .原创 2021-03-14 20:30:59 · 192 阅读 · 0 评论 -
线性表合并(链表实现)
#include <iostream>using namespace std;typedef struct LNode{ int data; struct LNode *next;} LNode, *LinkList;void Input(LinkList &Head){ Head = new LNode; Head->next = NULL; LinkList p, r; r = Head; cout <.原创 2021-03-14 20:28:23 · 914 阅读 · 0 评论 -
有序表合并(顺序表实现)
#include <iostream>#define MAXSIZE 100using namespace std;typedef struct SqList{ int *data; int length;} SqList;void Input(SqList &L){ int m, i; cout << "请输入有序集合元素的个数:" << endl; cin >> m; for (i =.原创 2021-03-14 20:26:34 · 482 阅读 · 0 评论 -
链栈的应用位制转换
#include <iostream>using namespace std;typedef struct StackNode{ int data; struct StackNode *next;} StackNode, *LinkStack;void Push(LinkStack &S, int n){ LinkStack p; p = new StackNode; p->data = n; p->next = .原创 2021-03-14 20:23:23 · 196 阅读 · 0 评论 -
排序算法
原创 2020-11-18 21:59:17 · 187 阅读 · 0 评论 -
链表排序
#include<iostream>using namespace std;#include<string.h>typedef struct{ char name[100]; char num[10]; int score; }Student;typedef struct LNode{ Student data; struct LNode *next; }LNode, *LinkList;int main(){ LinkList Head, p, q, .原创 2020-11-16 23:41:13 · 178 阅读 · 0 评论 -
学生信息管理系统(链表)
#include<iostream>#include<string.h> using namespace std;typedef struct{ char name[100]; char number[20]; float score;}Student;typedef struct LNode{ Student data; struct LNode *n...原创 2019-04-15 23:26:01 · 3257 阅读 · 0 评论