㈠ 求用vc寫的模擬煙花效果的源代碼
關於 vc 裡面使用 graphics.h 的問題,你只需要安裝 easyx 即可,網路一下吧。另外你可以到網路 easyx 貼吧查找相關資源,官網也有使用演示。
關於圖標的問題,你打開我的電腦 -> 工具 -> 文件夾選項 -> 文件類型,然後在裡面修改 .c 和 .cpp 的圖標即可。
㈡ 修仙家族模擬器物品代碼
可以通過最新內置菜單開啟功能後破解代碼。
開啟功能後輸入代碼,確定後再進入商店隨機購買物品,到手的就是代碼物品。例如,青蓮劍訣中的代碼是6081401,青蓮劍訣下的代碼是6081701,歸元劍典中的代碼是6081301,歸元劍典中下的代碼6081601等等。
一組數字就是一種裝備排序,從高階到低階進行排序。
㈢ 求用C++做的"電梯模擬程序"的源代碼
別人的東西,你看看吧
/*
* Elevator.h
* ElevatorAssignment
*
* Created by Isaac Huang on 08-6-23.
* Copyright 2008 __MyCompanyName__. All rights reserved.
*
*/
class Elevator
{
private:
int WhichFloor;
public:
Elevator();
void ChangeFloor(int);
int GetFloor();
void Working();
};
/*
* Elevator.cpp
* ElevatorAssignment
*
* Created by Isaac Huang on 08-6-23.
* Copyright 2008 __MyCompanyName__. All rights reserved.
*
*/
#include "Elevator.h"
#include <iostream.h>
Elevator::Elevator():WhichFloor(1){}
void Elevator::ChangeFloor(int num)
{
cout<<"Elevator Goes From "<<WhichFloor<<" To "<<num<<endl;
WhichFloor=num;
}
int Elevator::GetFloor()
{
return WhichFloor;
}
/*
* Building.h
* ElevatorAssignment
*
* Created by Isaac Huang on 08-6-23.
*
*/
#include "Floor.h"
#include "Elevator.h"
class Building
{
private:
Floor Floor1;
Floor Floor2;
Elevator Eleva;
int WorkTime;
public:
Building();
void Running(int);
void Print(int);
};
/*
* Building.cpp
* ElevatorAssignment
*
* Created by Isaac Huang on 08-6-23.
*
*/
#include "Building.h"
#include <stdlib.h>
#include <iostream.h>
#include <time.h>
Building::Building():Floor1(1),Floor2(2),WorkTime(0){}
void Building::Running(int OrderTime)
{
int i,iLater1=0,iLater2=0,Spent;
for(i=1;i<=OrderTime;i+=Spent)
{
Spent=1;
srand(time(0));
int Number1=5+rand()%16;
if((i-iLater1)==Number1)
{
Floor1.CreatePeople();
iLater1=i;
}
srand(time(0));
int Number2=5+rand()%16;
if((i-iLater2)==Number2)
{
Floor2.CreatePeople();
iLater2=i;
}
if(Eleva.GetFloor()==1)
{
if(Floor1.ReturnPeople()!=0)
{
Floor1.GetInside();
Eleva.ChangeFloor(2);
WorkTime++;
Spent=5;
Print(i+Spent);
}
else if(Floor2.ReturnPeople()!=0)
{
Eleva.ChangeFloor(2);
Floor2.GetInside();
Eleva.ChangeFloor(1);
WorkTime++;
Spent=10;
Print(i+Spent);
}
}
else if(Eleva.GetFloor()==2)
{
if(Floor2.ReturnPeople()!=0)
{
Floor2.GetInside();
Eleva.ChangeFloor(1);
WorkTime++;
Spent=5;
Print(i+Spent);
}
else if(Floor1.ReturnPeople()!=0)
{
Eleva.ChangeFloor(1);
Floor1.GetInside();
Eleva.ChangeFloor(2);
WorkTime++;
Spent=10;
Print(i+Spent);
}
}
}
//Print(OrderTime);
}
void Building::Print(int Time)
{
cout<<"Work Time: "<<Time<<"s"<<endl;
cout<<WorkTime<<" People Have Been Transported."<<endl;
cout<<"The Number Of People On The 1st Floor: "<<Floor1.ReturnPeople()<<endl;
cout<<"The Number Of People On The 2nd Floor: "<<Floor2.ReturnPeople()<<endl;
}
/*
* Floor.h
* ElevatorAssignment
*
* Created by Isaac Huang on 08-6-23.
*
*/
class Floor
{
private:
int FloorNumber;
int PeopleOnThisFloor;
public:
Floor(int);
void CreatePeople();
void GetInside();
int ReturnNumber();
int ReturnPeople();
};
/*
* Floor.cpp
* ElevatorAssignment
*
* Created by Isaac Huang on 08-6-23.
*
*/
#include "Floor.h"
Floor::Floor(int num):FloorNumber(num)
{
if(FloorNumber==1)
PeopleOnThisFloor=100;
else
PeopleOnThisFloor=100;
}
void Floor::CreatePeople()
{
PeopleOnThisFloor++;
}
int Floor::ReturnNumber()
{
return FloorNumber;
}
void Floor::GetInside()
{
PeopleOnThisFloor--;
}
int Floor::ReturnPeople()
{
return PeopleOnThisFloor;
}
#include "Building.h"
int main()
{
Building Sample;
Sample.Running(3600);
return 0;
}
㈣ 一個pc安卓模擬器是怎麼開發出來的,有開源源碼么
可以說沒有,網上確實有IOS模擬器PC版,但是這個玩意是個IOS的SDK開發者方便在WINDOWS環境里開發調試IOS應用的,不會是你想想的那種用個這個模擬器就能直接安裝IOS的應用或者游戲來玩了,這個直接運行不了,必須是源代碼才能運行。不過你可以嘗試用虛擬機安裝蘋果的MAC OS山獅系統。或者直接安裝黑蘋果。還有安卓模擬器的說法不準確。這個玩意應該叫安卓虛擬機。IOS你就別想了,不開源的系統是基本不可能你想像中的那種模擬器的。
㈤ 什麼是模擬源代碼
假如你的電腦里有個開關控制的電燈,你通過點擊滑鼠打開開關就可以使電腦里的電燈點亮,這就像現實的情況一樣。如果你寫程序的正確與否代表打開開關的動作,你寫好的程序輸入到電腦里,如果你的程序正確就能使電腦里的電燈亮否者就滅。就是說模擬是通過電腦模擬現實的情況。模擬源代碼其實和源代碼有時就是一樣,只不過可能要適應某些不同的模擬軟體而有修改。
㈥ 求一份c#商品模擬找零系統源碼,老師的要求是,輸入商品總金額(例如1546),輸入所給金額(例如2
代碼
classProgram
{
//人民幣面額
privatestaticdecimal[]moneyArr=newdecimal[]{100M,50M,20M,10M,5M,2M,1M,0.5M,0.2M,0.1M,0.05M,0.02M,0.01M};
//存各種面額的人民幣發放份數
privatestaticint[]moneyCountList=null;
staticvoidMain(string[]args)
{
decimalcurrentMoney=188.88M;
int[]moneyCount=Calculate(currentMoney);
Console.WriteLine("當前需找零金額:{0}¥",currentMoney);
for(inti=0;i<moneyCount.Length;i++)
Console.WriteLine("面額{0}¥共{1}張",moneyArr[i],moneyCount[i]);
Console.ReadLine();
}
///<summary>
///計算發放金額數
///</summary>
///<paramname="money"></param>
///<returns></returns>
staticint[]Calculate(decimalmoney)
{
moneyCountList=newint[]{0,0,0,0,0,0,0,0,0,0,0,0,0};
inttmpMoney=NumHelper(money);
while(tmpMoney>0)
{
for(inti=0;i<moneyArr.Length;i++)
{
if(tmpMoney>=NumHelper(moneyArr[i]))
{
intresult=tmpMoney/NumHelper(moneyArr[i]);//直接除,比一條一條減算的快
moneyCountList[i]=result;//對應的發送份數
tmpMoney=tmpMoney%NumHelper(moneyArr[i]);//余數
break;
}
}
}
returnmoneyCountList;
}
///<summary>
///將金錢轉換成整數處理
///</summary>
///<paramname="money"></param>
///<returns></returns>
staticintNumHelper(decimalmoney)
{
returnConvert.ToInt32(money*100);
}
}
㈦ 怎麼用c語言模擬寫發52張撲克牌,求源碼
代碼很長 就不打了
思路就是做一個數組
比如
int a[4][13];
代表四個人
然後 1~52 這52個數 代表牌
定義int a[52];
初始化為0 表示牌是否發出去
然後用rand()%52+1獲取隨機數 如果沒發出去的 那麼 分配給對應人。
㈧ Mame模擬器的source code文件是做什麼用的,怎麼用
source code源代碼
程序員用開發工具所支持的語言寫出來的源文件
像MAMEPLUS!就是MAME愛好者用源代碼重新編譯的
源代碼是給編程人員准備的,
如果你是編程人員你自然會知道那些東西是什麼
如果你不是的話,請無視那些東西1
㈨ 易語言後台模擬滑鼠、鍵盤的模塊或者源碼
不能用是因為人家游戲用API把你的模擬按鍵功能和諧了...解決方法:網路 易語言 驅動鍵盤模擬(其實驅動級的模擬就是直接模擬你滑鼠和鍵盤的操作,自然也無法和諧....超級模塊里有不同的模擬按鍵方式,你也可以一個個的試過去-_-!)
㈩ 求用C語言模擬簡單檯球運動的源代碼,不需要圖形化界面
這源代碼應該有個桌面類(Table),球類(Sphere),游戲類等等。我用C++
#pragma once (Table.h)
#endif // _MSC_VER > 1000
#include "Base.h"
#define MESH_D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1)
class CTable:public CBase
{
public:
DWORD Render();
CTable(LPDIRECT3DDEVICE8 pD3DDevice,LPSTR pFilename);
virtual ~CTable();
LPD3DXMESH GetMeshTablePointer();
private:
void TransformTable();
LPDIRECT3DDEVICE8 m_pD3DDevice;
DWORD m_dwNumMaterials;
LPD3DXMESH m_pMeshTable;
D3DMATERIAL8 *m_pMeshTableMaterials;
LPDIRECT3DTEXTURE8 *m_pMeshTableTextures;
};#endif
#include "Table.h" (Table.cpp)
CTable::CTable(LPDIRECT3DDEVICE8 pD3DDevice,LPSTR pFilename)
{
LPD3DXBUFFER pMaterialsBuffer=NULL;
LPD3DXMESH pMeshTable=NULL;
m_pD3DDevice=pD3DDevice;
if(FAILED(D3DXLoadMeshFromX(pFilename,D3DXMESH_MANAGED,m_pD3DDevice,NULL,
&pMaterialsBuffer,&m_dwNumMaterials,&pMeshTable)))
{
m_pMeshTable=NULL;
m_pMeshTableMaterials=NULL;
m_pMeshTableTextures=NULL;
LogError("<li>Table Mesh '%s' failed to load",pFilename);
return;
}
D3DXMATERIAL *matMaterials=(D3DXMATERIAL*)pMaterialsBuffer->GetBufferPointer();
//Create two arrays. One to hold the materials and one to hold the textures
m_pMeshTableMaterials=new D3DMATERIAL8[m_dwNumMaterials];
m_pMeshTableTextures=new LPDIRECT3DTEXTURE8[m_dwNumMaterials];
for(DWORD i=0;i<m_dwNumMaterials;i++)
{
//Copy the material
m_pMeshTableMaterials[i]=matMaterials[i].MatD3D;
//Set the ambient color for the material(D3DX does not do this)
m_pMeshTableMaterials[i].Ambient=m_pMeshTableMaterials[i].Diffuse;
D3DCOLORVALUE rgbaSpecular={0.0f,0.0f,0.0f,0.0f};
m_pMeshTableMaterials[i].Specular=rgbaSpecular;
m_pMeshTableMaterials[i].Power=50.0f;
//Create the texture
char buffer[255];
sprintf(buffer,"textures/%s",matMaterials[i].pTextureFilename);
if(FAILED(D3DXCreateTextureFromFile(m_pD3DDevice,
buffer, &m_pMeshTableTextures[i])))
{
m_pMeshTableTextures[i]=NULL;
}
}
//finished with the material buffer,so release it
SafeRelease(pMaterialsBuffer);
//Make sure that the normals are setup for mesh
pMeshTable->CloneMeshFVF(D3DXMESH_MANAGED,MESH_D3DFVF_CUSTOMVERTEX,m_pD3DDevice,&m_pMeshTable);
SafeRelease(pMeshTable);
// D3DXComputeNormals(m_pMesh);
LogInfo("<li>Mesh '%s' loaded OK",pFilename);
}
CTable::~CTable()
{
SafeDelete(m_pMeshTableMaterials);
if(m_pMeshTableTextures != NULL)
{
for(DWORD i=0;i<m_dwNumMaterials;i++)
{
if(m_pMeshTableTextures[i])
SafeRelease(m_pMeshTableTextures[i]);
}
}
SafeDelete(m_pMeshTableTextures);
SafeRelease(m_pMeshTable);
LogInfo("<li>Table Mesh destroyed OK");
}
DWORD CTable::Render()
{
TransformTable();
if(m_pMeshTable!=NULL)
{
for(DWORD i=0;i<m_dwNumMaterials;i++)
{
m_pD3DDevice->SetMaterial(&m_pMeshTableMaterials[i]);
m_pD3DDevice->SetTexture(0,m_pMeshTableTextures[i]);
m_pMeshTable->DrawSubset(i);
}
return m_pMeshTable->GetNumFaces();
}
else
return 0;
}
LPD3DXMESH CTable::GetMeshTablePointer()
{
return m_pMeshTable;
}
void CTable::TransformTable()
{
D3DXMATRIX matWorld;
D3DXMatrixTranslation(&matWorld,0,0,0);
m_pD3DDevice->SetTransform(D3DTS_WORLD,&matWorld);
}
(Sphere.h)
#if !defined (AFX_SPHERE_H__FC705F3B_568E_4973_B608_B8F7700D9ECE__INCLUDED_)
#define AFX_SPHERE_H__FC705F3B_568E_4973_B608_B8F7700D9ECE__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Base.h"
#define SPHERE_D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1)
class CSphere:public CBase
{
private:
struct SPHERE_CUSTOMVERTEX
{
float x,y,z; //Position of vertex in 3D space
float nx,ny,nz; //Lighting Normal
float tu,tv; //Texture coordinates
};
struct SPHERE_STATE
{
D3DXVECTOR3 sVector; //Position of Centigram in 3D space
D3DXVECTOR3 vVector; //Direction of Velocity in 3D space
float v; //Speed of Sphere
};
SPHERE_STATE *m_pSphereState;
D3DXVECTOR3 m_vecSavePosition; //Save sphere position for collision bar
D3DXVECTOR3 m_vecSavePosition2; //Save sphere position for collision sphere
public:
BOOL SetMaterial(D3DCOLORVALUE rgbaDiffuse,D3DCOLORVALUE rgbaAmbient,
D3DCOLORVALUE rgbaSpecular,D3DCOLORVALUE rgbaEmissive,float rPower);
BOOL SetTexture(const char* szTextureFilePath);
DWORD Render();
CSphere(LPDIRECT3DDEVICE8 pD3DDevice,int iRings=20,int iSegments=20);
void MoveSphere();
void MoveSphereForUser(float x,float z);
virtual ~CSphere();
inline void SetSpherePosition(float x,float y,float z)
{
m_pSphereState->sVector.x=x;
m_pSphereState->sVector.y=y;
m_pSphereState->sVector.z=z;
};
inline void GetSpherePosition(D3DXVECTOR3 &vecSpherePos)
{
vecSpherePos=m_pSphereState->sVector;
};
inline void GetSavedSpherePosition(D3DXVECTOR3 &vecSavedSpherePos)
{
vecSavedSpherePos=m_vecSavePosition;
};
inline void GetSavedSpherePosition2(D3DXVECTOR3 &vecSavedSpherePos)
{
vecSavedSpherePos=m_vecSavePosition2;
};
inline void SaveSpherePosition()
{
m_vecSavePosition=m_pSphereState->sVector;
};
inline void SaveSpherePosition2()
{
m_vecSavePosition2=m_pSphereState->sVector;
};
inline void ContradictoryZv()
{
m_pSphereState->vVector.z=-m_pSphereState->vVector.z;
};
inline void ContradictoryXv()
{
m_pSphereState->vVector.x=-m_pSphereState->vVector.x;
};
void MirrorVAoubtAxis(D3DXVECTOR3 &n);
inline void ReceSphereVelocity(float percent)
{
m_pSphereState->v=m_pSphereState->v*percent;
};
inline float CheckSphereEnergy()
{
return m_pSphereState->v;
};
inline void SetSphereVelocityDir(const D3DXVECTOR3 &vDir)
{
m_pSphereState->vVector=vDir;
};
inline void SetSphereVelocity(const float &velocity)
{
m_pSphereState->v=velocity;
};
inline void GetSphereVelocityDir(D3DXVECTOR3 &vDir)
{
vDir=m_pSphereState->vVector;
};
inline float GetSphereVelocity()
{
return m_pSphereState->v;
};
inline void SetSphereStateToFalse()
{
m_bSphereInUse=FALSE;
};
inline void SetSphereStateToTrue()
{
m_bSphereInUse=TRUE;
};
inline BOOL GetSphereState()
{
return m_bSphereInUse;
};
void SetSphereVelocityAt_Y_NegativeAxis();
inline float GetSpherePosAt_Y_Axis()
{
return m_pSphereState->sVector.y;
};
private:
BOOL CreateIndexBuffer();
BOOL UpdateVertices();
BOOL CreateVertexBuffer();
void TransformSphere();
void TransformSphereForUser();
void UpdateSpherePosition();
void FrictionReseVelocity();
LPDIRECT3DDEVICE8 m_pD3DDevice;
LPDIRECT3DVERTEXBUFFER8 m_pVertexBuffer;
LPDIRECT3DTEXTURE8 m_pTexture;
D3DMATERIAL8 m_matMaterial;
LPDIRECT3DINDEXBUFFER8 m_pIndexBuffer;
int m_iRings;
int m_iSegments;
float m_fTotalDis;
D3DXVECTOR3 m_vecSphereRotationAxis;
BOOL m_bSphereInUse;
DWORD m_dwNumOfVertices;
DWORD m_dwNumOfIndices;
DWORD m_dwNumOfPolygons;
};#endif