當前位置:首頁 » 編程語言 » c語言奧運會視頻
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

c語言奧運會視頻

發布時間: 2022-04-25 23:57:10

c語言編程 實驗三:第30屆夏季奧運會將於2012年7月27日在倫敦舉行,本屆奧運.....新手求教!

1 用二維數組char name[1000][50];
2 國家名字肯定是字元串而不是單個字元,用scanf("%s",name[n]);
3 交換國家名字時用strcpy進行字元串的復制

⑵ c語言奧運會開幕式

這是一個約瑟夫環的問題。這個問題c語言實現代碼如下:
#include <stdio.h>
#include <stdlib.h>
struct _Node
{
int data;
struct _Node *next;
};
typedef struct _Node node_t;
typedef struct _Linklist
{
node_t * phead;
node_t * ptail;
int len;
}Linklist;
static node_t * GetNode( int i ) // 新建並初始化節點
{
node_t *pNode;
pNode = ( node_t * )malloc( sizeof( node_t ) );
if(!pNode)
{
printf("Error,the memory is not enough!\n");
exit(-1);
}
pNode -> data = i;
pNode -> next = NULL;
return pNode;
}
void init_list( Linklist *plist ) // 用第一個節點初始化循環單鏈表
{
node_t *p;
p = GetNode( 1 );
// printf("The New Node is: %d\n", p -> data); // **** TEST ****
plist -> phead = p;
plist -> ptail = p;
p -> next = plist -> phead;
plist -> len = 1;
}
static void Create_List( Linklist *plist, int n ) // 把其餘數據添加到循環單鏈表中
{
int i = 0;
node_t *pNew;
for(i=2;i<=n;i++)
{
pNew = GetNode( i );
/******** TEST ********
printf("The New Node is: %d\n", pNew -> data);
******** TEST ********/
plist -> ptail -> next = pNew;
plist -> ptail = pNew;
pNew -> next = plist -> phead;
plist -> len ++;
}
printf("Completes the e-way circulation chain table the foundation!\n");
}
void Print_List( Linklist *plist ) // 輸出鏈表內容
{
node_t *pCur = plist -> phead;
do
{
printf("The %d person.\n", pCur -> data );
pCur = pCur -> next;
}while( pCur != plist -> phead );
printf("The length of the List: %d\n", plist -> len );
}
void joseph( Linklist *plist, int m ) //約瑟夫回環函數實現
{
node_t *pPre = plist -> ptail;
node_t *pCur = plist -> phead;
int i;
while( plist -> len != 1 )
{
i = 0;
while( i < m-1 )
{
pPre = pPre -> next;
i ++;
}
pCur = pPre -> next;
pPre -> next = pCur -> next;
free( pCur );
plist -> len --;
}
printf("The last one is: %d\n", pPre -> data );
}
int main()
{
int n = 0;
printf("輸入學生人數 ");
scanf("%d", &n );
int m = 0;
printf("輸入m的值 ");
scanf("%d", &m );
Linklist pList;
init_list( &pList );
Create_List( &pList, n );
Print_List( &pList );
joseph( &pList, m );
return 0;
}

⑶ C語言編寫08年北京奧運會入場順序

使用字元串的比較

⑷ C語言題目 奧運金牌榜 (排序) 題目描述 按時間順序給出奧運會的獲獎情況,根據獲獎情況輸出金牌榜。

#include<stdio.h>
#include<string.h>
intmain()
{
intcount,i,j;
charc[1024][1024],ig[1024],ip[1024];
intp[1024][3];
scanf("%d",&count);
for(i=0;i<count;i++){
scanf("%s%s",ig,ip);
for(j=0;c[j][0]!='';j++)
if(!strcmp(c[j],ig)){
if(!strcmp(ip,"jin"))
p[j][0]+=1;
elseif(!strcmp(ip,"yin"))
p[j][1]+=1;
elseif(!strcmp(ip,"tong"))
p[j][2]+=1;
break;
}
if(c[j][0]==''){
strcpy(c[j],ig);
if(!strcmp(ip,"jin"))
p[j][0]+=1;
elseif(!strcmp(ip,"yin"))
p[j][1]+=1;
elseif(!strcmp(ip,"tong"))
p[j][2]+=1;
}}
for(i=0;c[i][0];i++)
printf("%s%d%d%d ",c[i],p[i][0],p[i][1],p[i][2]);
return0;
}

⑸ C語言編譯畫奧運五環

沒聽錯吧 C編譯 暈哦
flash乾的

⑹ 用C語言怎樣編輯奧運五環圖案

編寫一個程序就可以打出來了 如果你只是要把圖形顯示在DOS上那麼直接用第一個程序就可以了(在程序里*號該空格的就空格,我復制進來的時候有空格的,可我也不知道怎麼的顯示在網頁上的時候就沒有空格了): 第一個程序: #include<iostream> using namespace std; void main() { cout<<"(四個)*"<<endl; cout<<"(三個)***"<<endl; cout<<"(兩個)*****"<<endl; cout<<"(一個)*******"<<endl; cout<<"*********"<<endl; cout<<"(一個)*******"<<endl; cout<<"(兩個)*****"<<endl; cout<<"(三個)***"<<endl; cout<<"(四個)*"<<endl; } 如果你是要把圖行保存在一個TXT文本里,那你就用下面這個程序二: 程序二: #include <stdio.h> #include <stdlib.h> #include <string.h> void main() { FILE *fp; char str[80]; if((fp=fopen("tuxing.txt","w"))==NULL) { printf("Cannot open file"); exit(0); } do { printf("Enter a string (Cr to quit):\n"); gets(str); if(*str!='\n') { strcat(str,"\n"); fputs(str,fp); } }while(*str!='\n'); printf("\n\n Displaying Contents of File JAK1\n\n"); rewind(fp); while (!feof(fp)) { fgets(str,81,fp); printf("\n%s",str); } fclose(fp); } //輸入方法:把你要顯示的圖形一行一行的輸入進去,輸入結束之後按會車鍵就可以退出,再去程序目錄下打開tuxing.txt文件就可以看見你要的圖形了

⑺ 用C語言編一個程序實現在屏幕上輸出「北京2008奧運會(換行) 然後下一行是 WE ARE READY

void
main()
{
printf("北京2008奧運會");
printf("\n");
/*換行*/
printf("WE
ARE
READY");
getch();
/*程序暫停,按任意鍵退出*/
}

⑻ 用C++如果實現奧運倒計時

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void wait ( int seconds )
{
clock_t endwait;
endwait = clock () + seconds * CLK_TCK ;
while (clock() < endwait) {}
}

void main(){
time_t rawtime;
struct tm * target_time;
int d,h,m,s;
int k=0;
long double dif,r;
time_t now,t_end; // in sec

/* get current timeinfo and modify it to the user's choice */
time ( &rawtime );
target_time = localtime ( &rawtime );

// time struc and to time_t
target_time->tm_year = 2008 - 1900; //year - 1900
target_time->tm_mon= 8 - 1; // month - 1
target_time->tm_mday = 8 ; // day
target_time->tm_hour = 8 ; // hour
target_time->tm_min = 1 ;
target_time->tm_sec = 1 ;
t_end = mktime (target_time);
// printf("%s ",ctime(&t_end)); //print and check

while (k < 120)
{
now = time (NULL);
// printf("%s ",ctime(&now)); // print and check
dif = difftime (t_end,now); //double , time_t time_t
// printf( "%lf\n",dif);
d = (int) (dif / 86400.0);
r = dif - d * 86400.0;
h = (int) (r / 3600.0);
r = r - h * 3600.0;
m = (int) (r / 60.0);
r = r - m * 60.0;
s = (int) (r);
printf("%d天%d小時%d分%d秒\n",d,h,m,s);

(void) wait ( 2 ); // every 2 seconds print
k = k + 1;
system("CLS");

};
}

用c語言的,你改下就行了

⑼ 奧運獎牌計數 c語言怎麼編程

#include<stdio.h>
intmain()
{
inti,n,medal[3],a[100];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%d%d",&medal[0],&medal[1],&medal[2]);
a[i]=medal[0]+medal[1]+medal[2];
}
for(i=0;i<n;i++)
printf("%d ",a[i]);
return0;
}