当前位置:首页 » 编程软件 » 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;
}

热点内容
b站如何知道账号密码 发布:2024-05-08 20:33:55 浏览:691
知识图谱算法 发布:2024-05-08 20:33:19 浏览:908
手机登云服务器windows 发布:2024-05-08 20:32:57 浏览:113
上传3d模型 发布:2024-05-08 20:11:41 浏览:604
国内访问外国网站 发布:2024-05-08 20:09:40 浏览:859
wifi热点无internet访问 发布:2024-05-08 20:09:37 浏览:892
林肯哪个配置最好 发布:2024-05-08 20:02:42 浏览:68
java变量的声明 发布:2024-05-08 19:50:44 浏览:977
c语言大数阶乘 发布:2024-05-08 19:40:51 浏览:543
华为手机上滑自动出来清理缓存 发布:2024-05-08 19:29:21 浏览:284