當前位置:首頁 » 操作系統 » 玩主源碼

玩主源碼

發布時間: 2022-11-28 20:34:53

① 跪地求好玩的java 源代碼~

連連看java源代碼
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class lianliankan implements ActionListener
{
JFrame mainFrame; //主面板
Container thisContainer;
JPanel centerPanel,southPanel,northPanel; //子面板
JButton diamondsButton[][] = new JButton[6][5];//游戲按鈕數組
JButton exitButton,resetButton,newlyButton; //退出,重列,重新開始按鈕
JLabel fractionLable=new JLabel("0"); //分數標簽
JButton firstButton,secondButton; //分別記錄兩次被選中的按鈕
int grid[][] = new int[8][7];//儲存游戲按鈕位置
static boolean pressInformation=false; //判斷是否有按鈕被選中
int x0=0,y0=0,x=0,y=0,fristMsg=0,secondMsg=0,validateLV; //游戲按鈕的位置坐標
int i,j,k,n;//消除方法控制
public void init(){
mainFrame=new JFrame("JKJ連連看");
thisContainer = mainFrame.getContentPane();
thisContainer.setLayout(new BorderLayout());
centerPanel=new JPanel();
southPanel=new JPanel();
northPanel=new JPanel();
thisContainer.add(centerPanel,"Center");
thisContainer.add(southPanel,"South");
thisContainer.add(northPanel,"North");
centerPanel.setLayout(new GridLayout(6,5));
for(int cols = 0;cols < 6;cols++){
for(int rows = 0;rows < 5;rows++ ){
diamondsButton[cols][rows]=new JButton(String.valueOf(grid[cols+1][rows+1]));
diamondsButton[cols][rows].addActionListener(this);
centerPanel.add(diamondsButton[cols][rows]);
}
}
exitButton=new JButton("退出");
exitButton.addActionListener(this);
resetButton=new JButton("重列");
resetButton.addActionListener(this);
newlyButton=new JButton("再來一局");
newlyButton.addActionListener(this);
southPanel.add(exitButton);
southPanel.add(resetButton);
southPanel.add(newlyButton);
fractionLable.setText(String.valueOf(Integer.parseInt(fractionLable.getText())));
northPanel.add(fractionLable);
mainFrame.setBounds(280,100,500,450);
mainFrame.setVisible(true);
}
public void randomBuild() {
int randoms,cols,rows;
for(int twins=1;twins<=15;twins++) {
randoms=(int)(Math.random()*25+1);
for(int alike=1;alike<=2;alike++) {
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
while(grid[cols][rows]!=0) {
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
}
this.grid[cols][rows]=randoms;
}
}
}
public void fraction(){
fractionLable.setText(String.valueOf(Integer.parseInt(fractionLable.getText())+100));
}
public void reload() {
int save[] = new int[30];
int n=0,cols,rows;
int grid[][]= new int[8][7];
for(int i=0;i<=6;i++) {
for(int j=0;j<=5;j++) {
if(this.grid[i][j]!=0) {
save[n]=this.grid[i][j];
n++;
}
}
}
n=n-1;
this.grid=grid;
while(n>=0) {
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
while(grid[cols][rows]!=0) {
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
}
this.grid[cols][rows]=save[n];
n--;
}
mainFrame.setVisible(false);
pressInformation=false; //這里一定要將按鈕點擊信息歸為初始
init();
for(int i = 0;i < 6;i++){
for(int j = 0;j < 5;j++ ){
if(grid[i+1][j+1]==0)
diamondsButton[i][j].setVisible(false);
}
}
}
public void estimateEven(int placeX,int placeY,JButton bz) {
if(pressInformation==false) {
x=placeX;
y=placeY;
secondMsg=grid[x][y];
secondButton=bz;
pressInformation=true;
}
else {
x0=x;
y0=y;
fristMsg=secondMsg;
firstButton=secondButton;
x=placeX;
y=placeY;
secondMsg=grid[x][y];
secondButton=bz;
if(fristMsg==secondMsg && secondButton!=firstButton){
xiao();
}
}
}
public void xiao() { //相同的情況下能不能消去。仔細分析,不一條條注釋
if((x0==x &&(y0==y+1||y0==y-1)) || ((x0==x+1||x0==x-1)&&(y0==y))){ //判斷是否相鄰
remove();
}
else{
for (j=0;j<7;j++ ) {
if (grid[x0][j]==0){ //判斷第一個按鈕同行哪個按鈕為空
if (y>j) { //如果第二個按鈕的Y坐標大於空按鈕的Y坐標說明第一按鈕在第二按鈕左邊
for (i=y-1;i>=j;i-- ){ //判斷第二按鈕左側直到第一按鈕中間有沒有按鈕
if (grid[x][i]!=0) {
k=0;
break;
}
else{ k=1; } //K=1說明通過了第一次驗證
}
if (k==1) {
linePassOne();
}
}
if (y<j){ //如果第二個按鈕的Y坐標小於空按鈕的Y坐標說明第一按鈕在第二按鈕右邊
for (i=y+1;i<=j ;i++ ){ //判斷第二按鈕左側直到第一按鈕中間有沒有按鈕
if (grid[x][i]!=0){
k=0;
break;
}
else { k=1; }
}
if (k==1){
linePassOne();
}
}
if (y==j ) {
linePassOne();
}
}
if (k==2) {
if (x0==x) {
remove();
}
if (x0<x) {
for (n=x0;n<=x-1;n++ ) {
if (grid[n][j]!=0) {
k=0;
break;
}
if(grid[n][j]==0 && n==x-1) {
remove();
}
}
}
if (x0>x) {
for (n=x0;n>=x+1 ;n-- ) {
if (grid[n][j]!=0) {
k=0;
break;
}
if(grid[n][j]==0 && n==x+1) {
remove();
}
}
}
}
}
for (i=0;i<8;i++ ) { //列
if (grid[i][y0]==0) {
if (x>i) {
for (j=x-1;j>=i ;j-- ) {
if (grid[j][y]!=0) {
k=0;
break;
}
else { k=1; }
}
if (k==1) {
rowPassOne();
}
}
if (x<i) {
for (j=x+1;j<=i;j++ ) {
if (grid[j][y]!=0) {
k=0;
break;
}
else { k=1; }
}
if (k==1) {
rowPassOne();
}
}
if (x==i) {
rowPassOne();
}
}
if (k==2){
if (y0==y) {
remove();
}
if (y0<y) {
for (n=y0;n<=y-1 ;n++ ) {
if (grid[i][n]!=0) {
k=0;
break;
}
if(grid[i][n]==0 && n==y-1) {
remove();
}
}
}
if (y0>y) {
for (n=y0;n>=y+1 ;n--) {
if (grid[i][n]!=0) {
k=0;
break;
}
if(grid[i][n]==0 && n==y+1) {
remove();
}
}
}
}
}
}
}
public void linePassOne(){
if (y0>j){ //第一按鈕同行空按鈕在左邊
for (i=y0-1;i>=j ;i-- ){ //判斷第一按鈕同左側空按鈕之間有沒按鈕
if (grid[x0][i]!=0) {
k=0;
break;
}
else { k=2; } //K=2說明通過了第二次驗證
}
}
if (y0<j){ //第一按鈕同行空按鈕在與第二按鈕之間
for (i=y0+1;i<=j ;i++){
if (grid[x0][i]!=0) {
k=0;
break;
}
else{ k=2; }
}
}
}
public void rowPassOne(){
if (x0>i) {
for (j=x0-1;j>=i ;j-- ) {
if (grid[j][y0]!=0) {
k=0;
break;
}
else { k=2; }
}
}
if (x0<i) {
for (j=x0+1;j<=i ;j++ ) {
if (grid[j][y0]!=0) {
k=0;
break;
}
else { k=2; }
}
}
}
public void remove(){
firstButton.setVisible(false);
secondButton.setVisible(false);
fraction();
pressInformation=false;
k=0;
grid[x0][y0]=0;
grid[x][y]=0;
}
public void actionPerformed(ActionEvent e) {
if(e.getSource()==newlyButton){
int grid[][] = new int[8][7];
this.grid = grid;
randomBuild();
mainFrame.setVisible(false);
pressInformation=false;
init();
}
if(e.getSource()==exitButton)
System.exit(0);
if(e.getSource()==resetButton)
reload();
for(int cols = 0;cols < 6;cols++){
for(int rows = 0;rows < 5;rows++ ){
if(e.getSource()==diamondsButton[cols][rows])
estimateEven(cols+1,rows+1,diamondsButton[cols][rows]);
}
}
}
public static void main(String[] args) {
lianliankan llk = new lianliankan();
llk.randomBuild();
llk.init();
}
}

//old 998 lines
//new 318 lines

基於JAVA的3D坦克游戲源代碼

http://www.newasp.net/code/java/4400.html

JAVA猜數字小游戲源代碼

/*1、編寫一個猜數字的游戲,由電腦隨機產生一個100以內的整數,讓用戶去猜,如果用戶猜的比電腦大,則輸出「大了,再小點!」,反之則輸出「小了,再大點!」,用戶總共只能猜十次,並根據用戶正確猜出答案所用的次數輸出相應的信息,如:只用一次就猜對,輸出「你是個天才!」,八次才猜對,輸出「笨死了!」,如果十次還沒有猜對,則游戲結束!*/
import java.util.*;
import java.io.*;
public class CaiShu{
public static void main(String[] args) throws IOException{
Random a=new Random();
int num=a.nextInt(100);
System.out.println("請輸入一個100以內的整數:");
for (int i=0;i<=9;i++){
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
String str=bf.readLine();
int shu=Integer.parseInt(str);
if (shu>num)
System.out.println("輸入的數大了,輸小點的!");
else if (shu<num)
System.out.println("輸入的數小了,輸大點的!");
else {
System.out.println("恭喜你,猜對了!");
if (i<=2)
System.out.println("你真是個天才!");
else if (i<=6)
System.out.println("還將就,你過關了!");
else if (i<=8)
System.out.println("但是你還……真笨!");
else
System.out.println("你和豬沒有兩樣了!");

break;}
}
}

}

② C++做一個小游戲,有源代碼的最好,謝謝

#include <iostream>
#include<fstream>
#include <ctime>
#include <cmath>
#include <stdlib.h>
#include<stdio.h> //時間 //文件
#include <string>
#define random(x)(rand()%x)
using namespace std;
void thunder(int Dif,int Row,int Column,char *USer)
{
int r,c,alls[22][22],backstage[22][22]={0};
srand((int)time(0));
for(r=1;r<=Row;r++) // 生成alls(0~1)1是雷
{
for(c=1;c<=Column;c++)
{
if(random(6)<1) {alls[r][c]=1;} else{alls[r][c]=0;};
}
};
for(r=0;r<=Row+1;r++) //生成 backstage(正確答案)
{
for(int c=0;c<=Column+1;c++)
{
if(alls[r][c]==1)
{
(int)backstage[r][c]='*'; //將1變為 * 代表雷
}
else
{
for(int i=r-1;i<=r+1;i++) //將0變為數字 (代表周圍雷數)
for(int j=c-1;j<=c+1;j++)
{

if(alls[i][j]!=alls[r][c]&&alls[i][j]==1){backstage[r][c]++;};
}
}; //else 結束
}; // for 結束
}; // for 結束
cout<<"======================*********================================"<<endl;
char surface[22][22]; //生成surface(用戶界面)
for(r=0;r<22;r++) //全部為零
for(c=0;c<22;c++)
{
surface[r][c]='0';
}
for(r=1;r<=Row;r++) //中間化 # 形成0包圍#的形式 (通過數 #-->(*||數字) 的個數 贏的時候停止循環)
for(c=1;c<=Column;c++)
{
surface[r][c]='#';
}
for(r=1;r<=Row;r++) //輸出 surface 界面 便於檢查
{
for(c=1;c<=Column;c++) {cout<<" "<<surface[r][c];};
cout<<endl;
};
cout<<"請按格式輸入"<<endl
<<"前兩個數字為坐標,最後一個數字「1」表示此位置為雷,「0」則表示不是。"<<endl
<<"如:1 3 1 表示一行三列是雷;2 4 0 表示二行四列不是雷"<<endl
<<"提示:當數字周圍雷都被掃出時,可再次按要求輸入此位置,可得到周圍數字。"<<endl;
long i=10000000L; //計算時間開始
clock_t start,finish;
double ration;
start=clock();
while(i--); //計算時間開始
int num=Row*Column; //計算#號個數
while(num!=0) //控制 是否點完所有位置
{
int x,y,judge;
cin>>x>>y>>judge;
if(alls[x][y]!=judge)
{
cout<<"you lose!!!"<<endl;
cout<<"The answer is:"<<endl;
for(r=1;r<=Row;r++) //輸了 輸出backstage 顯示正確答案
{
for(int c=1;c<=Column;c++)
{
cout<<" "<<(char)(backstage[r][c]==42?backstage[r][c]:backstage[r][c]+'0'); //輸出backstage
}
cout<<endl;
}
break;
}
else
{
if(alls[x][y]==1) {if(surface[x][y]=='#'){num--;}surface[x][y]='@'; } // 雷 判斷正確 顯示「@」;數「#」
else
{
if(backstage[x][y]!=0) // 數字 判斷正確 顯示數字
{
if(surface[x][y]=='#'){num--; surface[x][y]=backstage[x][y]+'0'; } // 數「#」
else
{
int lei_num=0;
for(int i=x-1;i<=x+1;i++) //數 數字周圍 雷的個數
for(int j=y-1;j<=y+1;j++)
{
if(surface[i][j]=='@')
lei_num++;
}
if(backstage[x][y]==lei_num) // 看數字周圍雷是否全部掃出 提示 顯示數字周圍
{
for(int i=x-1;i<=x+1;i++)
for(int j=y-1;j<=y+1;j++)
if(surface[i][j]=='#') //數「#」
{
surface[i][j]=backstage[i][j]+'0';
num--;
}
}
}
}
else // 數字為零時 顯示零周圍的零
{
if(surface[x][y]=='#'){num--;}; //數「#」
surface[x][y]=backstage[x][y]+'0';
for(int i=x-1;i<=x+1;i++) // 顯示零周圍的數字
for(int j=y-1;j<=y+1;j++)
if(surface[i][j]=='#') // 避免 死循環
{
surface[i][j]=backstage[i][j]+'0';
num--; //數「#」
}
for(int k=0;k<20;k++) //最多20層零 (點出最邊上的零)
{
for (int R=1;R<=Row;R++) //檢查所有零
for(int C=1;C<=Column;C++) //再次顯示零周圍的數字
{
if(surface[R][C]=='0')
{
for(int i=R-1;i<=R+1;i++)
for(int j=C-1;j<=C+1;j++)
{
if(surface[i][j]=='#') // 避免 死循環 數「#」
{
surface[i][j]=backstage[i][j]+'0';
num--;
}
}
}
} //匹配for 內
} //匹配 for 外
}//匹配else
}//匹配else
}//匹配els
cout<<endl;
cout<<"======================*********================================"<<endl;
for(r=1;r<=Row;r++) //輸出界面(已修改)
{
for(c=1;c<=Column;c++) {cout<<" "<<surface[r][c];};
cout<<endl;
};
} //匹配while
finish=clock(); //計算時間結束
ration=(double)(finish-start)/CLOCKS_PER_SEC; //時間變數
if(num==0) //所有
{
cout<<" You win! Congratulations!! "<<endl;
cout<<" Your time is: "<<ration<<endl;
if(Dif==1) //讀取 簡單掃雷 的存儲文件
{
string Name;
string name[6];
double Time,rang;
double times[6];
int i=0;
ifstream inf("掃雷 簡單.txt");
for(i=0;i<5;i++) //文件中信息導入到數組里
{
inf>>Name;inf>>rang>>Time;
name[i]=Name;
times[i]=Time;
}
inf.close();
name[5]=USer; //本輪玩家信息
times[5]=ration;
double t1=0;
string t2;
for(int j=0;j<5;j++) //冒泡排序法
{
for(i=0;i<5-j;i++)
{
if(times[i]>times[i+1])
{
t1=times[i];
times[i]=times[i+1];
times[i+1]=t1;
t2=name[i];
name[i]=name[i+1];
name[i+1]=t2;
}
}
}
ofstream outf("掃雷 簡單.txt");
for(i=0;i<5;i++) //將前五名玩家信息存儲到文件中
{
cout<<name[i]<<" "<<i+1<<" "<<times[i]<<endl;
outf<<name[i]<<" "<<i+1<<" "<<times[i]<<endl;
}
outf.close();
}
if(Dif==2) //讀取 一般掃雷 的存儲文件
{
string Name;
string name[6];
double Time,rang;
double times[6];
int i=0;
ifstream inf("掃雷 一般.txt");
for(i=0;i<5;i++) //文件中信息導入到數組里
{
inf>>Name;inf>>rang>>Time;
name[i]=Name;
times[i]=Time;
}
inf.close();
name[5]=USer; //本輪玩家信息
times[5]=ration;
double t1=0;
string t2;
for(int j=0;j<5;j++) //冒泡排序法
{
for(i=0;i<5-j;i++)
{
if(times[i]>times[i+1])
{
t1=times[i];
times[i]=times[i+1];
times[i+1]=t1;
t2=name[i];
name[i]=name[i+1];
name[i+1]=t2;
}
}
}
ofstream outf("掃雷 一般.txt");
for(i=0;i<5;i++) //將前五名玩家信息存儲到文件中 並輸出
{
cout<<name[i]<<" "<<i+1<<" "<<times[i]<<endl;
outf<<name[i]<<" "<<i+1<<" "<<times[i]<<endl;
}
outf.close();
}
if(Dif==3) //讀取 困難掃雷 的存儲文件
{
string Name;
string name[6];
double Time,rang;
double times[6];
int i=0;
ifstream inf("掃雷 困難.txt");
for(i=0;i<5;i++) //文件中信息導入到數組里
{
inf>>Name;inf>>rang>>Time;
name[i]=Name;
times[i]=Time;
}
inf.close();
name[5]=USer; //本輪玩家信息
times[5]=ration;
double t1=0;
string t2;
for(int j=0;j<5;j++) //冒泡排序法
{
for(i=0;i<5-j;i++)
{
if(times[i]>times[i+1])
{
t1=times[i];
times[i]=times[i+1];
times[i+1]=t1;
t2=name[i];
name[i]=name[i+1];
name[i+1]=t2;
}
}
}
ofstream outf("掃雷 困難.txt");
for(i=0;i<5;i++) //將前五名玩家信息存儲到文件中
{
cout<<name[i]<<" "<<i+1<<" "<<times[i]<<endl;
outf<<name[i]<<" "<<i+1<<" "<<times[i]<<endl;
}
outf.close();
}
}
}
void scale(int dif,char *User) //選擇難度
{
int row,column;
if(dif==1) {row=3;column=3;}
if(dif==2) {row=7;column=7;}
if(dif==3) {row=10;column=10;}
cout<<"The scale is: "<<row<<"*"<<column<<endl;
thunder(dif,row,column,User);
};
int main()
{
int Continue=1;
int difficulty;
char user[10];
cout<<" Welcom to the game! "<<endl
<<" 請輸入用戶名! "<<endl;
cin>>user;
while(Continue==1)
{
cout<<"=======================*******************======================="<<endl
<<" 請選擇難度! "<<endl
<<" 簡單——1 "<<endl
<<" 一般——2 "<<endl
<<" 困難——3 "<<endl;
cin>>difficulty;
scale(difficulty,user);
cout<<"繼續游戲——1 結束游戲——0"<<endl;
cin>>Continue;
}
return 0;
}
掃雷小游戲,自己編的代碼

③ 求C語言編寫的壁球小游戲的源代碼,謝謝。

速度和 接板 長度不能改

所以比較難玩

#include "graphics.h"
#include "stdio.h"
#include "conio.h" /*所需的頭文件*/

int on; /*聲明具有開關作用的全局變數*/
static int score; /*聲明靜態的記分器變數*/

/* 定義開始界面函數*/

int open()
{
setviewport(100,100,500,380,1); /*設置圖形窗口區域*/
setcolor(4); /*設置作圖色*/
rectangle(0,0,399,279); /*以矩形填充所設的圖形窗口區域*/
setfillstyle(SOLID_FILL,7); /*設置填充方式*/
floodfill(50,50,4); /*設置填充范圍*/
setcolor(8);
settextstyle(0,0,9); /*文本字體設置*/
outtextxy(90,80,"BALL"); /*輸出文本內容*/
settextstyle(0,0,1);
outtextxy(110,180,"version 1.0");
outtextxy(110,190,"made by ddt");
setcolor(128);
settextstyle(0,0,1);
outtextxy(120,240,"Press any key to continue......");
}

/*定義退出界面函數*/
int quitwindow()
{
char s[100]; /*聲明用於存放字元串的數組*/
setviewport(100,150,540,420,1);
setcolor(YELLOW);
rectangle(0,0,439,279);
setfillstyle(SOLID_FILL,7);
floodfill(50,50,14);
setcolor(12);
settextstyle(0,0,8);
outtextxy(120,80,"End");
settextstyle(0,0,2);
outtextxy(120,200,"quit? Y/N");
sprintf(s,"Your score is:%d",score);/*格式化輸出記分器的值*/
outtextxy(120,180,s);
on=1; /*初始化開關變數*/
}

/*主函數*/
main()
{
int gdriver,gmode;
gdriver=DETECT; /*設置圖形適配器*/
gmode=0; /*設置圖形模式*/
registerbgidriver(EGAVGA_driver);/* 注冊BGI驅動後可以不需要.BGI文件的支持運行 */
initgraph(&gdriver,&gmode,"");
setbkcolor(14);
open(); /*調用開始界面函數*/
getch(); /*暫停*/

while(1) /*此大循環體控制游戲的反復重新進行*/
{
int driver,mode,l=320,t=400,r,a,b,dl=5,n,x=200,y=400,r1=10,dx=-2,dy=-2;/*初始化小球相關參數*/
int left[100],top[100],right[100],bottom[100],i,j,k,off=1,m,num[100][100];/*方磚陣列相關參數*/
static int pp;
static int phrase; /*一系列起開關作用的變數*/
int oop=15;
pp=1;
score=0;
driver=DETECT;
mode=VGA;
registerbgidriver(EGAVGA_driver);
initgraph(&driver,&mode,"");
setbkcolor(10);
cleardevice(); /*圖形狀態下清屏*/
clearviewport(); /*清除現行圖形窗口內容*/
b=t+6;
r=l+60;
setcolor(1);
rectangle(0,0,639,479);
setcolor(4);
rectangle(l,t,r,b);
setfillstyle(SOLID_FILL,1);
floodfill(l+2,t+2,4);

for(i=0,k=0;i<=6;i++) /*此循環繪制方磚陣列*/
{
top[i]=k;
bottom[i]=top[i]+20;
k=k+21;
oop--;
for(j=0,m=0;j<=7;j++)
{
left[j]=m;
right[j]=left[j]+80;
m=m+81;
setcolor(4);
rectangle(left[j],top[i],right[j],bottom[i]);
setfillstyle(SOLID_FILL,j+oop);
floodfill(left[j]+1,top[i]+1,4);
num[i][j]=pp++;
}
}

while(1) /*此循環控制整個動畫*/
{
while(!kbhit())
{
x=x+dx; /*小球運動的圓心變數控制*/
y=y+dy;
if(x+r1>r||x+r1<r)
{ phrase=0;}
if((x-r1<=r||x+r1<=r)&&x+r1>=l)
{
if(y<t)
phrase=1;
if(y+r1>=t&&phrase==1)
{dy=-dy;y=t-1-r1;}
}

if(off==0)
continue;

for(i=0;i<=6;i++) /*此循環用於判斷、控制方磚陣列的撞擊、擦除*/

for(j=0;j<=7;j++)
{
if((x+r1<=right[j]&&x+r1>=left[j])||(x-r1<=right[j]&&x-r1>=left[j]))
{
if(( y-r1>top[i]&&y-r1<=bottom[i])||(y+r1>=top[i]&&y+r1<=bottom[i] ))
{
if(num[i][j]==0)
{continue; }
setcolor(10);
rectangle(left[j],top[i],right[j],bottom[i]);
setfillstyle(SOLID_FILL,10);
floodfill(left[j]+1,top[i]+1,10);
dy=-dy;
num[i][j]=0;
score=score+10;
printf("%d\b\b\b",score);
}
}
if((y+r1>=top[i]&&y+r1<=bottom[i])||(y-r1>=top[i]&&y-r1<=bottom[i]))
{
if((x+r1>=left[j]&&x+r1<right[j])||(x-r1<=right[j]&&x-r1>left[j]))
{
if(num[i][j]==0)
{ continue;}
setcolor(10);
rectangle(left[j],top[i],right[j],bottom[i]);
setfillstyle(SOLID_FILL,10);
floodfill(left[j]+1,top[i]+1,10);
dx=-dx;
num[i][j]=0;
score=score+10;
printf("%d\b\b\b",score);
}
}
}

if(x+r1>639) /*控制小球的彈射范圍*/
{dx=-dx;x=638-r1;}
if(x<=r1)
{dx=-dx;x=r1+1;}
if(y+r1>=479)
{off=0;quitwindow();break;}
if(y<=r1)
{dy=-dy;y=r1+1;}
if(score==560)
{off=0;quitwindow();break;}
setcolor(6);
circle(x,y,r1);
setfillstyle(SOLID_FILL,14);
floodfill(x,y,6);
delay(1000);
setcolor(10);
circle(x,y,r1);
setfillstyle(SOLID_FILL,10);
floodfill(x,y,10);
}

a=getch();
setcolor(10);
rectangle(l,t,r,b);
setfillstyle(SOLID_FILL,10);
floodfill(l+2,t+2,10);
if(a==77&&l<=565) /*鍵盤控制設定*/
{dl=20;l=l+dl;}
if(a==75&&l>=15)
{dl=-20;l=l+dl;}
if(a=='y'&&on==1)
break;
if(a=='n'&&on==1)
break;
if(a==27)
{quitwindow();off=0;}
r=l+60;
setcolor(4);
rectangle(l,t,r,b);
setfillstyle(SOLID_FILL,1);
floodfill(l+5,t+5,4);
delay(100);
}
if(a=='y'&&on==1) /*是否退出遊戲*/
{break;}
if(a=='n'&&on==1)
{ continue;}
}
closegraph();

}

你不是要求在TC里運行么
C++和C不同的
如果要在C++里
你前面要寫函數的聲明的
C里就不用

修改過了,試一試吧。
我這里可以
一閃而過那個是圖形界面的問題
驅動沒安裝好

④ 求C++小游戲源代碼啊~

一個戀愛小測試賊靈驗哦
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m,a,b,c,d,e,f,g,h,i,j,k,l,sum;
cout<<"歡迎來到戀愛指數測試器*>-<*"<<endl;
for(int i=1;i<=1000000000;i++)
l=i;
cout<<"獨家的哦*^0^*"<<endl;
for(int i=1;i<=1000000000;i++)
l=i;
cout<<"以下異性均為合適年齡"<<endl;
for(int i=1;i<=1000000000;i++)
l=i;
cout<<"下列問題如果是則輸入2,如果不是則輸入1,一點也沒感覺輸入0"<<endl;
for(int i=1;i<=1000000000;i++)
l=i;
cout<<"加油,面對你自己!*-o-*"<<endl;
for(int i=1;i<=1000000000;i++)
l=i;
cout<<"question one:"<<"你是否面對異性時有莫名心跳?"<<endl;
cin>>n;
cout<<endl;
cout<<"question two:"<<"你是否有看到異性被撩時很憤怒?"<<endl;
cin>>m;
cout<<endl;
cout<<"question three:"<<"你是否懼怕見到一位異性的家長"<<endl;
cin>>a;
cout<<endl;
cout<<"question four:"<<"你是否經常刷一位異性的QQ或其他軟體"<<endl;
cin>>b;
cout<<endl;
cout<<"question five:"<<"想不想真心和Ta用情頭?"<<endl;
cin>>c;
cout<<endl;
cout<<"question six:"<<"和Ta邂逅過嗎?"<<endl;
cin>>d;
cout<<endl;
cout<<"question seven:"<<"吃過同一個飯碗里的東西嗎?"<<endl;
cin>>e;
cout<<endl;
cout<<"question eight:"<<"有過一個人在夢里與Ta相遇嗎?"<<endl;
cin>>f;
cout<<endl;
cout<<"question nine:"<<"有為了等Ta一個人站在風雨中嗎?"<<endl;
cin>>g;
cout<<endl;
cout<<"question ten:"<<"想kissTa不,想摸Ta的頭發嗎?"<<endl;
cin>>h;
cout<<endl;
sum=n+m+a+b+c+d+e+f+g+h;
cout<<"正在測評中,請稍後..."<<endl;
for(int i=1;i<=1000000000;i++)
l=i;
if(sum>=16&&sum<=20)
cout<<"你的戀愛指數為:A。你是一個深深愛著Ta的人,你往往會走到最後^-^。"<<endl;
if(sum<=15&&sum>=12)
cout<<"你的戀愛指數為:B。你是一個矛盾卻又不失愛意的人,你的愛往往一波三折!-!。"<<endl;
if(sum<=11&&sum>=7)
cout<<"你的戀愛指數為:C。你是一個有點點情絲的人,你想表,卻又懼怕現實,你仍須努力o-o。"<<endl;
if(sum<=6&&sum>=0)
cout<<"你的戀愛指數為:D。你是一個無暇無垢,不食人間煙火的人,想一路踏歌,證道路上需佳人陪伴+-+。"<<endl;
if(sum>20||sum<0)
cout<<"你出格了喲ooo.ooo"<<endl;
cout<<"人生在世,恍如昨世,孤獨的身影終難走遠,你的那個Ta就在不遠方,就如漫天繁星,總有一顆屬於你!"<<endl;\
cout<<"快抓緊你身邊的那個Ta^-^oooooo"<<endl;
cout<<endl;
cout<<"作品創造者:yang sky one"<<endl;
cout<<"戀愛指數測試器已關閉,需重啟………………"<<endl;
return 0;
}

⑤ 在哪裡可以買到自己想要的網站源碼

淘寶網上有賣的,你先買一個貴的試一下,如果有問題你還可以退貨,其它的地方又不能退貨。

⑥ 簡單的html個人主頁源代碼

個人html主頁站點所提供的多半是純文字或圖片等靜態信息,而就站點的性質來說,則以教學或特定主題(如歷史、古典文學、電玩、旅遊記錄等)的站台為多數。

你可以通過千站素材下載html網頁源碼,製作你的"個人主頁",用於展示你自己的個性,將自己喜歡的東西放在"個人主頁"上,讓大家都可以來欣賞。

⑦ 我在網路上下載了一些java游戲源碼,擴展名是jar格式,請問怎麼打開

你把它直接扔到手機里就行了。
第一步:於手機的數據線連接(讀卡器也行)
第二補:把JAVA游戲扔到手機里
第三步:打開手機,安裝,
第四步:你可以玩了

⑧ 怎樣源碼建站我是新手想用源碼

不知道你想建什麼樣子的站。
WordPress應該是可以支持你的需求的,選個主題就好~自己寫寫文章,改改樣式。
flyzy小站 是我自己搭建的站。你可以網路搜一下,我就是php新手自己玩的~裡面還有我的建站教程

⑨ H5電玩城源碼帶文字教程,有誰會搭建安裝啊

把照片做成視頻,最主要的特點就是照片是靜止不動的,和視頻差別很大,我們可以現在其他的視頻軟體裡面進行視頻的製作,製作的時候,可以是多張照片的切換運動,也可以是單張照片然後添加上我們自己喜歡的音樂,然後導出手機的MP4格式,將這個視頻導入到手機裡面,在抖音裡面可以上傳這個視頻在抖音裡面點擊左上角的「上傳視頻」,然後找到剛才上傳的視頻接下來進行濾鏡的添加以及封面的選擇,點擊發布即可。

熱點內容
phprecv 發布:2025-05-17 11:55:00 瀏覽:610
福建時鍾監控網關伺服器雲主機 發布:2025-05-17 11:54:28 瀏覽:248
c資料庫壓縮 發布:2025-05-17 11:39:22 瀏覽:960
安卓手機如何連接音響功放 發布:2025-05-17 11:37:48 瀏覽:958
破解exe加密視頻 發布:2025-05-17 11:23:41 瀏覽:976
我的世界伺服器圈太大了怎麼辦 發布:2025-05-17 11:15:21 瀏覽:614
便宜的免費雲伺服器 發布:2025-05-17 11:08:50 瀏覽:779
中國頂級dhcp解析伺服器地址 發布:2025-05-17 11:06:27 瀏覽:36
php轉義html 發布:2025-05-17 11:04:00 瀏覽:569
鋼筋籠加密區規范 發布:2025-05-17 10:59:50 瀏覽:6