1樓:青雲
int sum(int start, int count)return num;
}int main (void)
printf ("sum=%d", num);
return 0;}
求c語言大神 用的dev c++ 急急急!!!
2樓:聽不清啊
#include
int fib(int n)
int main()
求c語言大神 用的dev c++ 急急
3樓:聽不清啊
#include
int prime(int n)
int main()
{int i,j,n;
scanf("%d",&n);
if(n%2)n++;
for(i=n;i
4樓:s如詩如夢
財富值太少了,不想寫
求c語言大神 用的dev c++ 程式片斷題
5樓:仙亦佛
#include
#include
#include
double updown(double x,int n)double a=x;
int b=(int)a*pow(10,n+1);
if(b%10>=5)
a=(b/10+1)*1.0/pow(10,n);
else
a=b/10*1.0/pow(10,n);
return a;
}int main(void)
printf("sum=%g\n",sum);
return 0;
}手機上寫的,沒測試。
6樓:匿名使用者
result=double(int(x*pow(10,n)+0.5))/pow(10,n);
手機打的,大概思路就是乘以一個數讓要保留的小數變為整數,然後加0.5強轉為int,實現後一位的四捨五入,再除以原來的數,得到結果
dev-c++小遊戲**,急急急急!!!!!
7樓:布雅志
//你看看行不行?
//貪吃蛇
#include
#include
#include
#define left 0x4b00
#define right 0x4d00
#define down 0x5000
#define up 0x4800
#define esc 0x011b
int i,key;
int score=0;
int gamespeed=32000;
struct food /*食物的結構體*/
food;
struct snack /*蛇的結構體*/
snake;
void init(void); /*圖形驅動*/
void close(void); /*關閉遊戲函式*/
void drawk(void); /*畫圖函式*/
void gameover(void);/*輸出失敗函式*/
void gameplay(); /*遊戲控制函式 主要程式*/
void prscore(void); /*分數輸出函式*/
delay(char ch)/*調節遊戲速度*/
else if(ch=='2')
}menu()/*遊戲開始選單*/
clrscr();
return(ch);
}/*主函式*/
void main(void)
void init(void)
void drawk(void)
for(i=40;i<=450;i+=10)
}void gameplay(char ch)
if(food.yes==0) /*有食物了就要顯示出來*/
for(i=snake.node-1;i>0;i--) /*貪吃蛇的移動演算法*/
switch(snake.direction) /*貪吃蛇的頭部移動演算法,以此來控制移動*/
for(i=3;i595||snake.y[0]<55||snake.y[0]>455)
if(snake.life==1) /*如果死亡就退出迴圈*/
break;
判斷蛇是否吃到食物*/
setcolor(4); /*每次移動後將後面的身體擦去*/
for(i=0;i rectangle(snake.x[i],snake.y[i],snake.x[i]+10,snake.y[i]-10); delay(gamespeed); delay(ch); setcolor(0); rectangle(snake.x[snake.node-1],snake. y[snake.node-1],snake.x[snake. node-1]+10,snake.y[snake.node-1]-10); }if(snake.life==1) break; key=bioskey(0); /*接受按鍵*/ if(key==esc) break; else 判斷是否改變方向*/ snake.direction=3; else snake.direction=1; else snake.direction=2; else snake.direction=4;}} void gameover(void) void prscore(void) void close(void) 8樓: #include #include #include #include #include using namespace std; /**************** all the structures ****************/ typedef struct frame frame; /**************** all the functions ****************/ void setpos(coord a)// set cursor void setpos(int i, int j)// set cursor ;setpos(pos); }void hidecursor() }//把第y行,[x1, x2) 之間的座標填充為 ch void drawrow(int y, int x1, int x2, char ch) void printcoord(coord a) break; }case 's' : break; }case 'k' :}} }}/* dword winapi musicfun(lpvoid lpparamte) *//****************=== the game class ***************===*/ class game ;game::game() void game::initplane() ;position[0].x=position[5].x=position[7].x=position[9].x=centren.x; position[1].x=centren.x-2; position[2].x=position[6].x=centren.x-1; position[3].x=position[8].x=centren.x+1; position[4].x=centren.x+2; for(int i=0; i<=4; i++) position[i].y=centren.y; for(int i=6; i<=8; i++) position[i].y=centren.y+1; position[5].y=centren.y-1; position[9].y=centren.y-2; }void game::drawplane() }void game::drawplanetonull() } void game::initbullet() void game::drawbullet()}} void game::drawbullettonull() ;setpos(pos); cout<<" ";} } void game::initenemy() ;coord b=; for(int i=0; i<8; i++) }void game::drawenemy() void game::drawenemytonull() } void game::pause() void game::planemove(char x) void game::bulletmove() ;drawthisbullettonull( pos ); bullet[i].y=30;}} }}void game::enemymove() ;coord b=; enemy[i].position[0] = random(a, b); enemy[i].position[1].x = enemy[i].position[0].x + 3; enemy[i].position[1].y = enemy[i].position[0].y + 2;}} }void game::judgeplane() }void game::drawthisbullettonull( coord c) void game::drawthisenemytonull( frame f ) void game::judgeenemy() ;coord b=; enemy[i].position[0] = random(a, b); enemy[i].position[1].x = enemy[i].position[0].x + 3; enemy[i].position[1].y = enemy[i].position[0].y + 2; drawthisbullettonull( bullet[j] ); bullet[j].y = 30;}} void game::shoot() }void game::printscore() else if( score == 360 && flag_rank == 1) else if( score == 480 && flag_rank == 2) int x=rank/5; setpos(60, 6); cout<= rank ) flag_enemy = 0; /* 輸出得分 */ printscore();}} void game::gameover() ;coord p2=; drawframe(p1, p2, '=', '|'); setpos(36,12); string str="game over!"; for(int i=0; i sleep(1000); system("cls"); drawframe(p1, p2, '=', '|'); setpos(31, 11); cout<<"擊落敵機:"< setpos(31, 12); cout<<"得 分:"< setpos(31, 13); cout<<"獲得稱號:"< setpos(30, 16); sleep(1000); cout<<"繼續? 是(y)| 否(n)"; as:char x=_getch(); if (x == 'n') exit(0); else if (x == 'y') else goto as; }/****************=== the main function ***************===*/ int main() include int fib int n int main 求c語言大神 用的dev c 急急急!int sum int start,int count return num int main void printf sum d num return 0 求c語言大神 用的dev c 急急 inc... include include define incre 0.07 int main printf the year is d i return 0 include include define n 10 int main for i 0 i n 1 i printf the result is n... 如果想輸入多個的話 要用迴圈,scanf函式的第二個引數為地址 比如說 你想用float english 10 來儲存10個英語成績的話 就可以了 如果你想一次性輸入一組資料 就是 學號 名字 成績 你就定義多個陣列 然後一起放到迴圈裡 比如定義3個陣列int number 10 char name...求C語言大神用的DEV C急急急
c語言急急急急急急,C語言 急急急急急急!!!
C語言,急急急