‘壹’ 用c语言编写,把"我爱你"三个字循环520次
#include "stdio.h"
void main{int i;for(i=0;i<520;i++) printf("我爱你");}ok
‘贰’ 如何用C语言编写程序,把"我爱你"循环520次
#include<stdio.h>
int main()
{
int i=0;
while(i<520)
{
printf("我爱你 ");
i++;
}
return 0;
}
采用while循环和printf输出函数即可。
(2)c语言我爱你无限循环扩展阅读:
在C语言中,有三种类型的循环语句:for语句、while语句和do While语句。分别介绍如下:
for
for为当型循环语句,它很好地体现了正确表达循环结构应注意的三个问题:
⑴控制变量的初始化。
⑵循环的条件。
⑶循环控制变量的更新。
while:
while结构循环为当型循环(when type loop),一般用于不知道循环次数的情况。维持循环的是一个条件表达式,条件成立执行循环体,条件不成立退出循环。
while语句格式为:
while(条件表达式)
循环体
每次执行循环体前都要对条件表达式进行判断。
do…while语句结构为直到型循环(until type loop),也用于不知道循环次数的情况。do…while和while的区别在于do…while结构是执行完一遍循环体再判断条件。
do while语句格式为:
do
循环体
while(条件表达式);
每执行完一次循环体,do…while结构都要判断一下条件表达式。
参考资料来源:网络-循环语句
‘叁’ 如何用c程序编写某某我爱你
#include <stdio.h>
#include <string.h>
int main()
{
char name[16];
int i;
printf("请输入一个你现在心里想的人的名字 "); //可改,可删
gets(name);
if(strcmp(name,"张三")==0) //在这里修改名字
for(i=1;i<=520;i++)
{
printf("第%3d次:",i); //不需要可以删掉
printf("我爱你1314 "); /*本来这两句printf是可以写成一句的,为了方便你删除,所以把上面的那句提出去了*/
}
else
printf(" 你是sb ");
return 0;
}
c程序总结
C语言既有高级语言的特点,又具有汇编语言的特点;既是一个成功的系统设计语言,又是一个实用的程序设计语言;既能用来编写不依赖计算机硬件的应用程序,又能用来编写各种系统程序;是一种受欢迎、应用广泛的程序设计语言。
C语言也有自身的不足,比如:C语言的语法限制不太严格,对变量的类型约束不严格,影响程序的安全性,对数组下标越界不作检查等。从应用的角度,C语言比其他高级语言较难掌握。
以上内容参考: 网络-c程序
‘肆’ 在C语言里,怎么做“我爱你”的一个程序呢
#include<stdio.h>
#include<stdlib.h>
intmain(void)
{
puts("我爱你");
returnEXIT_SUCCESS;
}
(4)c语言我爱你无限循环扩展阅读
C++的表达方式
usingnamespaceSystem;
voidmain()
{
Console::WriteLine("我爱你");
}
‘伍’ c语言编写我爱你
#include<stdio.h>
#include<stdlib.h>
main()
{
printf("/t我爱你")
system("pause")
}
‘陆’ C语言如何实现一个无限循环运动
//用C++写了个效果还算是可以的,你可以改成C试一试
#include <iostream>
//#include <system.h>
using namespace std;
void showLine(int n)
{
cout<<n<<": *********"<<endl;
}
void showN(int n)
{
cout<<n<<":"<<endl;
}
void delay(long n)//延时作用
{
long m,k,j,z;
m=k=j=z=n;
for(;n>0;n--)
for(;k>0;k--)
for(;j>0;j--)
for(;z>0;z--)
;
}
int main()
{
int i=0;
while(true)
{
//1
if(i%2!=0)
{
showLine(1);
showN(2);
showLine(3);
showN(4);
showLine(5);
showN(6);
showLine(7);
}
else
{
showN(1);
showLine(2);
showN(3);
showLine(4);
showN(5);
showLine(6);
showN(7);
}
//cin.clear();
system("cls");
delay(5000000); //这个自己写的延时函数实在不怎么样,效果还算可以吧
i++;
}
return 0;
}
//改了一下,完美解决
#include <iostream>
#include <windows.h>
using namespace std;
#define stl 50 //Sleep函数以毫秒为单位,Sleep(500);表示停半秒
void showLine(int n)
{
cout<<n<<": *********"<<endl;
}
void showN(int n)
{
cout<<n<<":"<<endl;
}
void delay(long n)//延时作用
{
long m,k,j,z;
m=k=j=z=n;
for(;n>0;n--)
for(;k>0;k--)
for(;j>0;j--)
for(;z>0;z--)
;
}
int main()
{
int i=0;
while(true)
{
//1
if(i%2!=0)
{
showLine(1);
showN(2);
showLine(3);
showN(4);
showLine(5);
showN(6);
showLine(7);
}
else
{
showN(1);
showLine(2);
showN(3);
showLine(4);
showN(5);
showLine(6);
showN(7);
}
//cin.clear();
system("cls");
//delay(5000000); //这个自己写的延时函数实在不怎么样,效果还算可以吧
Sleep(stl);
i++;
}
return 0;
}
‘柒’ 用c语言写我爱你,只能在输出结果里才可以看见,c语言
#include<iostream>//运行环境VS2010C++
usingnamespacestd;
voidmain()
{
chara=0xCE;
charb=0xD2;//”我“汉字国标码CED2
charc=0xB0;
chard=0xAE;//”爱“汉字国标码BOAE
chare=0xC4;
charf=0xE3;//”你“汉字国标码C4E3
charg=0xA3;
charh=0xA1;//”!“汉字国标码A3A1
cout<<a<<b<<c<<d<<e<<f<<g<<h<<endl;
}
‘捌’ 用c语言写我爱你用*拼出来的
#include <stdio.h>
int main(int argc, const char * argv[])
{
unsigned char a[4] = {230, 136, 145};
unsigned char b[4] = {231, 136, 177};
unsigned char c[4] = {228, 189, 160};
printf("%s%s%s", a, b, c);
return 0;
}
留下qq 不懂问我哦~642233706