當前位置:首頁 » 編程軟體 » c在線編程

c在線編程

發布時間: 2022-02-01 20:04:09

c語言在線編譯

#include<stdio.h>//頭文件補上
int max(int x,int y)//定義聲明函數
{
int z;
z=(x>y)?x:y;
return(z);
}
int main()
{
int a,b,c;
scanf("%d,%d",&a,&b);
c=max(a,b);//函數調用
printf("%d",c);
return 0;
}

Ⅱ C語言簡單編程 在線等

意思是在熒幕上顯示hello,world。有一處錯誤,括弧內要加引號,另外,要執行的話需要先編譯才行

Ⅲ 有什麼好的C語言在線編程網站嗎

南洋理工學院的OJ系統還是不錯的,希望對你有幫助,望採納

Ⅳ C語言編程,在線著急等

#include "stdio.h"

#include <stdlib.h>

#define N 5

int prime(int n){//質數判斷

int i;

if(n>2 && !(n&1) || n<2)

return 0;

for(i=3;i*i<=n;i+=2)

if(!(n%i))

return 0;

return 1;

}

int main(int argc,char *argv[]){

int a[N],i,k;

printf("Please enter %d positive integer(s)... ",N);

for(k=i=0;i<N;i++){//輸入數據

if(scanf("%d",a+i)==1 && a[i]>0)

k+=a[i];

else{//若輸入小於0則重新輸入

printf("Input error, redo: ");

i--;

fflush(stdin);

}

}

printf(" The AVERAGE is %g Prime Numbers are as follows: ",k/20.0);//輸出平均值

for(k=i=0;i<N;i++)//輸入質數

if(prime(a[i]))

printf(++k%3 ? "%11d" : "%11d ",a[i]);

if(k==0)

printf("No find prime Numbers... ");

else if(k%3)

printf(" ");

return 0;

}

運行樣例:

Ⅳ 跪求c語言在線編程網站

不如用WINTC才不到10MB

Ⅵ C語言編程在線等

main()
{
float a,b;
char ch;
scanf("%f%c%f",&a,&ch,&b);
switch(ch){
case '+':{printf("=%f",a+b);break;}
case '-':{printf("=%f",a-b);break;}
case '*':{printf("=%f",a*b);break;}
case '/':{printf("=%f",a/b);break;}
default:break;
}
getch();
}

Ⅶ 能實現輸入函數的C/C++在線編譯器

我認為目前最好用的在線編譯器; http://www.mcqyy.com/RunCode/cpp/

Ⅷ C語言編程 在線等

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

#defineN100

structscore
{
floatmath;
floatenglish;
floatcomputer;
};

structstudent
{
intnumber;
charname[20];
structscoresco;
floataverage;
};

structstudentstu[N];

floatinput_score(int);//計算學生平均成績
voidprint_student2(void);//顯示表頭
voidprint_student3(int);//顯示學生信息
voidprint_student1(int);//顯示全部學生資料
voidprint_student1(inta)//顯示全部學生資料
{
printf("本班所有學生具體信息如下 ");
print_student2();
for(inti=0;i<a;i++)
{
print_student3(i);
}
}

voidprint_student3(inta)//顯示學生信息
{
printf("%8d%12s%14.2f%14.2f%14.2f%14.2f ",stu[a].number,stu[a].name,stu[a].sco.math,stu[a].sco.english,stu[a].sco.computer,stu[a].average);
}

voidprint_student2(void)//顯示表頭
{
printf("學號姓名數學成績英語成績計算機成績平均成績 ");
}

voidinput_student1(inta)//輸入學生信息
{
printf("學號:");
scanf("%d",&stu[a].number);
getchar();
printf("姓名:");
gets(stu[a].name);
printf("數學成績:");
scanf("%f",&stu[a].sco.math);
printf("英語成績:");
scanf("%f",&stu[a].sco.english);
printf("計算機成績:");
scanf("%f",&stu[a].sco.computer);
}

floatinput_score(inta)//計算學生平均成績
{
return(stu[a].sco.math+stu[a].sco.english+stu[a].sco.computer)/3;
}

//voidmain()
intmain()
//最好是intmain
{
structstudentstu[N];
input_score(student);
print_student2(student);
print_student3(student);
print_student1(student);
print_student1(student);
return0;
//加上返回值
}

Ⅸ C語言編程在線求解。

#include <stdio.h>
int main()
{
int a[5][5]={{1,2,3,4,5},{6,7,8,9,10},{11,12,13,14,15},{16,17,18,19,20},{21,22,23,24,25}};
int i,j,s1=0,s2=0,s3=0;
for(i=0;i<5;i++)
s1=s1+a[i][i];
for(i=0,j=4;i<5,j>=0;j--,i++)
s2+=a[i][j];
for(i=0;i<5;i++)
s3=a[0][i]+s3;
for(i=1;i<4;i++)
s3=a[i][0]+s3+a[i][4];
for(i=0;i<5;i++)
s3=a[4][i]+s3;
printf("s1=%d,s2=%d,s3=%d\n",s1,s2,s3);
}

Ⅹ 在線c語言編程高手

#include <stdio.h>
int main()
{
float price=-1, last_price=-1;
int cnt = 0, total = 0;
int increase_flag = 0;
while(~scanf("%f", &price))
{
total++;
printf("%d\t%7.3f", total, price);
if(cnt > 2)
printf("\t%s", increase_flag ? "sell" : "buy");
printf("\n");
if(last_price != -1)
{
if(price > last_price)
{
if(increase_flag) cnt ++;
else increase_flag = 1, cnt = 1;
}
else if(price < last_price)
{
if(!increase_flag) cnt ++;
else increase_flag = 0, cnt = 1;
}
else cnt++;
}
last_price = price;
}
return 0;
}

part3的

#include <stdio.h>
int main()
{
float price=-1, last_price=-1;
int cnt = 0, total = 0;
int increase_flag = 0;
float cash = 10000, shares = 0;
printf("period price cash shares value\n");
printf("-----------------------------------------------\n");
while(~scanf("%f", &price))
{
total++;
if(cnt > 2)
{
if(increase_flag)
{
if(shares != 0)
{
cash = shares * price;
shares = 0;
}
}
else
{
if(cash != 0)
{
shares = cash / price;
cash = 0;
}
}
}
printf(" %3d \t%7.3f\t%10.2f\t%7.2f\t%10.2f\n", total, price, cash, shares, cash+shares * price);
if(last_price != -1)
{
if(price > last_price)
{
if(increase_flag) cnt ++;
else increase_flag = 1, cnt = 1;
}
else if(price < last_price)
{
if(!increase_flag) cnt ++;
else increase_flag = 0, cnt = 1;
}
else cnt++;
}
last_price = price;
}
return 0;
}

熱點內容
國產高配置有哪些 發布:2024-04-27 09:18:26 瀏覽:947
建行手機app忘記密碼如何修改 發布:2024-04-27 08:58:59 瀏覽:393
蟻群演算法的數學模型 發布:2024-04-27 08:58:39 瀏覽:994
androidactivity生命 發布:2024-04-27 07:33:48 瀏覽:84
win2008伺服器搭建網站 發布:2024-04-27 07:26:51 瀏覽:640
java的vector 發布:2024-04-27 07:05:00 瀏覽:204
舊電腦共享伺服器 發布:2024-04-27 06:32:21 瀏覽:339
java程序練習 發布:2024-04-27 06:24:00 瀏覽:438
sql30 發布:2024-04-27 06:22:10 瀏覽:55
怎樣防止sql注入 發布:2024-04-27 06:11:25 瀏覽:236