A. c语言打出蜡烛
是笑脸的,可能是编译器问题,也许是突然间的问题,你多运行几次。或者升级一下Dev吧,我用的都是5.4.1的了
B. 有一个圣诞快乐的程序据说是用C语言写的,我想把它改成生日快乐的,跪求原代码~谢谢各位
#include"stdio.h"
#include <string.h>
intmain(void){
chara[]="Iwishyouahappybirthday!Iwishyouahappybirthday!",m[4],i;
printf("\n\n\n");
printf("%*.*s\n",58,21,"_*=__=*_");
printf("%*.*s\n",61,25,"Wishyourbirthday!");
printf("%*.*s\n",63,29,"Iwishyouahappybirthday!");
printf("%*.*s\n",65,33,a);
printf("%*.*s\n",66,35,a);
printf("%*.*s\n",66,35,a);
printf("%*.*s\n",65,33,a);
printf("%*.*s\n",64,31,a);
printf("%*.*s\n",63,29,a);
printf("%*.*s\n",61,25,a);
printf("%*.*s\n",59,21,a);
printf("%*.*s\n",57,17,a);
printf("%*.*s\n",55,13,a);
printf("%*.*s\n",53,9,a);
printf("%*.*s\n",51,5,a);
printf("%*.*s\n",50,3,a);
printf("%*.*s\n",49,1,a);
return0;
}
(2)用c语言编写小明吹蜡烛扩展阅读
或者:
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#defineI20
#defineR340
intmain()
{
system("modeconcols=80lines=60");
system("title向你致以最诚挚的祝福!");
chardata[200][60]={{"祝你生日快乐!祝你生日快乐!"},{"\nHappybirthdaytoyou!\n"},{"Happybirthdaymydearfriend!\n"},
{"在你面前的台里本,总有一天是很独特!\n"},{"虽然你和我,没办法选,来到世界的某刻。\n"},{"天气寒冷,又或炎热,又或者什么血型和星座!\n"},
{"每年这刻,我对自己说,有生的日子要更快乐!\n"},{"天气寒冷,又或炎热,又或者什么血型和星座!\n"},{"每年这刻,我对自己说,有生的日子要更快乐!\n"},
{"爸爸妈妈辛苦了!谢谢你们为我付出太多!\n"},{"生日祝福,吹灭蜡烛,我要我自己不许哭。\n"},{"长大了一岁变得靠谱,继续走自己的旅程!\n"},
{"又到这一个时刻,幸福的花火,手机祝福收到很多很多。\n"},{"看到最后一条来自你,写着让我感动的话语。\n"},{"亲爱的朋友要经常联络,我们一起来唱这首歌!\n"},
{"祝你生日快乐额!我们一起快乐!\n"}
};
intsign=0;
inti,j,e;
inta;
longtime;
for(i=1,a=I;i<I/2;i++,a--)
{
for(j=(int) ( I-sqrt(I*I-(a-i)*(a-i)) );j>0;j--)
printf("");
for(e=1;e<=2*sqrt(I*I-(a-i)*(a-i));e++)
printf("\3");
for(j=(int)
( 2*( I-sqrt(I*I-(a-i)*(a-i)) ) );j>0;j--)
printf("");
for(e=1;e<=2*sqrt(I*I-(a-i)*(a-i));e++)
printf("\3");
printf("\n");
}
for(i=1;i<80;i++)
{
if(i==25)
{
printf("======祝,生日快乐。======");
i+=30;
}
printf("\3");
}
printf("\n");
for(i=1;i<=R/2;i++)
{
if(i%2||i%3)
continue;
for(j=(int) ( R-sqrt(R*R-i*i) );j>0;j--)
printf("");
for(e=1;e<=2*( sqrt(R*R-i*i) - (R-2*I) );e++)
printf("\3");
printf("\n");
}
for(;;)
{
system("colora");
for(time=0;time<99999999;time++); system("color b");
for(time=0;time<99999999;time++); system("color c");
for(time=0;time<99999999;time++); system("color d");
for(time=0;time<99999999;time++); system("color e");
for(time=0;time<99999999;time++); system("color f");
for(time=0;time<99999999;time++);
system("color 0"); for(time=0;time<99999999;time++);
system("color 1"); for(time=0;time<99999999;time++);
system("color 2"); for(time=0;time<99999999;time++);
system("color 3"); for(time=0;time<99999999;time++);
system("color4");
for(time=0;time<99999999;time++); system("color 5");
for(time=0;time<99999999;time++); system("color 6");
for(time=0;time<99999999;time++); system("color 7");
for(time=0;time<99999999;time++); system("color 8");
for(time=0;time<99999999;time++); system("color 9");
for(time=0;time<99999999;time++); system("color ab");
for(time=0;time<99999999;time++); system("color ac");
for(time=0;time<99999999;time++); system("color ad");
for(time=0;time<99999999;time++); system("color ae");
for(time=0;time<99999999;time++); system("color af");
for(time=0;time<99999999;time++);
printf("%s",data[sign]);
sign++;
}
return0;
}
C. 用C语言编写下列程序
#include <stdio.h>
int main()
{
int a=1,b=2,c=3,t;
t=a;
a=b;
b=t;
t=b;
b=c;
c=t;
printf("a=%d,b=%d,c=%d ",a,b,c);
return 0;
}
D. 有a根蜡烛,每根蜡烛可以点亮1分钟。然而可将b根用完的蜡烛搓成一根新的蜡烛。问蜡烛能燃烧多少分钟呢
仅供参考:
#include "stdio.h"
int firetime(int a,int b); //计算蜡烛燃烧时间
void main()
{
int a,b;
int sum;
printf("请输入蜡烛根数:");
scanf("%d",&a);
printf("多少根烧完的蜡烛可以搓成1根新蜡烛:");
scanf("%d",&b);
sum = firetime(a,b);
printf("这些蜡烛可以烧%d分钟。\n",sum);
}
int firetime(int a,int b)
{
int time_sum = 0; //燃烧时间
int lazhu_new =a; //蜡烛根数
int lazhu_old =0; //烧完的蜡烛
while(1)
{
time_sum += lazhu_new; //蜡烛燃烧过程
lazhu_old += lazhu_new; //蜡烛烧完,当前烧完的蜡烛的总数
if(lazhu_old < b) //如果烧完的蜡烛不够搓成一根,则退出循环
{
break;
}
lazhu_new = lazhu_old/b; //将b跟烧完的蜡烛搓成一根新的蜡烛
lazhu_old -= lazhu_new * b; //还剩下的烧完蜡烛数
}
return time_sum;
}
E. 如何用c语言实现蜡烛点燃这一过程
这个问题的核心不是语言,而是对这一过程的数学建模,抽象出了合适的模型,再用程序来实现就简单了。
F. 用简单的C语言写出如下题目
按照题目要求以及输入输出格式,程序代码如下,由于输出样式,一些不符合输出样式的输出语句使用//作为注释,如果需要格式,去掉//即可
#include<stdio.h>
#include<math.h>
structmonster
{
intx;
inty;
intz;
};
structskill
{
inta;
intb;
intr;
inth;
};
intmain()
{
intn,i,mk=0;;
monstera[10];
skills;
//printf("请输入怪物数量: ");
scanf("%d",&n);
while(n)
{
i=0;
mk=0;
//printf("请输入怪物信息: ");
while(i<n)
{
scanf("%d%d%d",&a[i].x,&a[i].y,&a[i].z);
i++;
}
//printf("请输入技能参数: ");
scanf("%d%d%d%d",&s.a,&s.b,&s.r,&s.h);
i=0;
while(i<n)
{
if(pow((a[i].x-s.a),2)+pow((a[i].y-s.b),2)<=pow(s.r,2)&&a[i].z<=s.h)
{
mk++;
}
i++;
}
//printf("本次技能消灭怪物数目:");
printf("%d ",mk);
scanf("%d",&n);
}
return0;
}
如果对您有帮助,望采纳。
G. 用c语言编写这道题的程序
#include<stdio.h>
int main()
{
int n,sum=0,t=0;
while(scanf("%d",&n),n!=0)
{
if(n>0)
{
sum+=n;
t++;
}
printf("%d %d\n",sum,t);
return 0;
}
H. C语言编程
首先是scanf读入double要用%lf
其次if else嵌套太多,一定要用花括号{},避免自己搞混
再次,变量名要有意义些
#include<stdio.h>
//#include"genlib.h"
//#include"simpio.h"
intmain(void){
intloopCount,i;//后面这些变量没有被用到啊m,n,s[10];
doubleopen,close,max,min;//给变量起有意义的名字
doubleupper,lower;//箱体的上下边界
scanf("%d",&loopCount);
for(i=0;i<loopCount;i++){//请遵循c语言从0开始的惯例
scanf("%lf%lf%lf%lf",&open,&close,&max,&min);
//判断箱体的上下边界
if(open>close){
upper=open;
lower=close;
}else{
upper=close;
lower=open;
}
//判断有无影线
if((max<=upper)&&(min>=lower)){
printf("无");
}else{
printf("有");
if(max>upper){
printf("上");
}
if(min<lower){
printf("下");
}
}
printf("影线的");
//判断是"空心红","实心蓝白"还是"十字红"
if(open<close){
printf("空心红");
}else{
if(open>close){
printf("实心蓝白");
}else{//open==close
printf("十字红");
}
}
printf("蜡烛 ");
}
}