c语言浪漫代码
① 有哪些代码是让你觉得非常浪漫的
hello world
② 谁给我写一个c语言表白代码。谢谢
楼主
我都帮你弄成功抄了,也不上来给我最佳答案啊。。。
C++代码,纯粹是凑图形的
呵呵
#include<iostream>
using
namespace
std;
#include<iostream>
using
namespace
std;
int
main()
{
cout<<
算了,度娘越来越垃。圾。了。连代码都不给发,你网络M我,我直接代码贴给你。。
③ 用C语言编写一个浪漫软件
#include<iostream>
using namespace std;
void prinstar(void)
{
cout<<" 爱爱爱爱爱爱爱爱爱爱爱爱爱"<<endl;
cout<<" 爱"<<endl;
cout<<" 爱 "<<endl;
cout<<" 爱"<<endl;
cout<<" 爱"<<endl;
cout<<" 爱"<<endl;
cout<<" 爱"<<endl;
cout<<" 爱"<<endl;
cout<<" 爱爱爱爱爱爱爱爱爱爱爱爱爱爱爱爱爱爱爱"<<endl;
}
void print_message(void)
{ cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<"爱 爱 爱 爱 爱爱爱爱爱爱"<<endl;
cout<<"爱 爱 爱 爱 爱 爱"<<endl;
cout<<"爱 爱 爱 爱 爱 爱"<<endl;
cout<<"爱 爱 爱 爱 爱 爱"<<endl;
cout<<"爱 爱 爱 爱 爱 爱爱爱爱爱爱"<<endl;
cout<<"爱 爱 爱 爱 爱 爱 "<<endl;
cout<<"爱 爱 爱 爱 爱 爱"<<endl;
cout<<"爱 爱 爱 爱 爱 爱"<<endl;
cout<<"爱爱爱爱爱 爱 爱 爱爱爱爱爱爱"<<endl;
}
void message(void)
{ cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" 爱 爱 爱 爱 爱"<<endl;
cout<<" 爱 爱 爱 爱 爱 爱 "<<endl;
cout<<" 爱 爱 爱 爱 爱 爱 "<<endl;
cout<<" 爱 爱 爱 爱 爱 爱 "<<endl;
cout<<" 爱 爱 爱 爱 爱 爱"<<endl;
cout<<" 爱 爱 爱 爱 爱 "<<endl;
cout<<" 爱 爱 爱 爱 爱爱"<<endl;
cout<<" 爱 爱 爱 爱 爱 爱"<<endl;
cout<<" 爱 爱 爱 爱 爱 爱"<<endl;
cout<<" 爱 爱 爱"<<endl;
}
int main(void)
{
prinstar();
print_message();
message();
return 0;
}
好像有好多运行不了,我也不知道怎么回事,毕业好多年了,现在连C语言是啥都不知道了,哎,岁月是吧杀猪刀啊
④ c语言放烟花代码
#include "stdlib.h"
#include "graphics.h"
#include "stdio.h"
#include "math.h"
#include "conio.h "
#define PI 3.1425926
main()
{
int gdriver=DETECT,gmode,errorcode;
int a[10],b[10],x,y,c,r,i,j,t;
double rad = 0.0;
/* initialize graphics and local variables */
initgraph(&gdriver , &gmode ,"");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error : %s/n",grapherrormsg(errorcode));
printf("Please any key to halt:");
getch();
exit(1); /* terminate with an error code */
}
randomize();
for(;!kbhit();)
{
x=rand()%500+100; /*随机中心坐标*/
y=rand()%300+100;
for(r = 0 ;r <= 8 ; r++ ) /*烟花的大小设定*/
{
for(i = 0,rad = 0.0 ; rad < 2*PI; rad += 0.78 ) /*设定坐标*/
{
a[i++] = x + (int)r *10* cos(rad);
b[ i ] = y + (int)r *10* sin(rad);
}
t = i;
for(i=1;i<t;i++)
{
c=rand()%13+1; /*各点的颜色随机*/
setcolor(c); /*功能:将当前图形屏幕的当前笔画颜色置为color.*/
circle(a[i],b[i],1);/* a[i],b[i] 为圆心 1 为半径 画圆 */
}
delay(10000);
delay(10000);
cleardevice();
函数名: cleardevice
功 能: 清除图形屏幕
用 法: void far cleardevice(void);
}
}
getch();
closegraph();
函数名: closegraph
功 能: 关闭图形系统
用 法: void far closegraph(void);
}
(4)c语言浪漫代码扩展阅读
C语言:表白显示(多彩小心心)
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define I 20
#define R 340
#include <string.h>
int main()
{
char answer[10];
printf("遇到你 我才发现 曾经所有的条件 似乎都成了我等你的借口 ");
printf("我对你的感情已经决堤 所以 请允许我,从今往后映入你 明媚的眼 ");
printf("我 想和你 耳鬓厮磨,相濡以沫!");
printf("答应我吧! 输入yes,你可以看到我的真心 ");
scanf("%s", answer);
float y, x, z, f;
for (y = 1.5f; y > -1.5f; y -= 0.1f)
{
for (x = -1.5f; x < 1.5f; x += 0.05f)
{
z = x * x + y * y - 1;
f = z * z*z - x * x*y*y*y;
putchar(f <= 0.0f ? "*********"[(int)(f*-8.0f)] : ' ');
}
putchar(' ');
}
long time;
for (;;)
{
system("color a");
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("color 4");
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");
}
getchar();
return 0;
}
⑤ 求一个示爱的小程序 C语言
void a(int aa)
{for(int i=0;i<aa;i++)printf(" ");}
void b()
{printf ("*");}
char c(int cc)
{printf("%c",cc);return 0;}
int main()
{a(6);b();a(3);b();a(5);b();a(3);b();
printf (" ");
a(4);b();a(8);b();a(8);b();
printf (" ");
a(3);b();a(19);b();
printf (" ");
a(3);b();a(4);c(73);a(1);c(76);c(111);c(118);
c(101);a(1);c(89);c(111);c(117);a(5);b();
printf (" ");
a(4);b();a(17);b();
printf (" ");
a(6);b();a(13);b();
printf (" ");
a(8);b();a(9);b();
printf (" ");
a(10);b();a(5);b();
printf (" ");
a(13);b();
printf (" ");return 0;
}
效果如下:
⑥ c语言 心形图案代码
#include <stdio.h>
int main(void)
{
float a,x,y;
for(y=1.5f; y>-1.5f; y-=0.1f)
{
for(x=-1.5f; x<1.5f; x+=0.05f)
{
a = x*x+y*y-1;
char ch = a*a*a-x*x*y*y*y<=0.0f?'*':' ';
putchar(ch);
}
printf(" ");
}
return 0;
}
(6)c语言浪漫代码扩展阅读:
书写规则
1、一个说明或一个语句占一行。
2、用{} 括起来的部分,通常表示了程序专的某一层次结属构。{}一般与该结构语句的第一个字母对齐,并单独占一行。
3、低一层次的语句或说明可比高一层次的语句或说明缩进若干格后书写。以便看起来更加清晰,增加程序的可读性。在编程时应力求遵循这些规则,以养成良好的编程风格。
网络-c语言
⑦ 求C语言编写的表白程序,要代码
#define IdYes 1002
#define IdNo 1003
#define IdStatic 1004
#define IdTimer 1005
#define Width 640
#define Height 480
#define Tick 2000
#include<windows.h>
int x,y;
RECT rdesk;
HINSTANCE hinst;
HWND hyes,hno;
BOOL quit=FALSE;
LRESULT CALLBACK WndProc(HWND hwnd,UINT Message,WPARAM wParam,LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
RECT rclient;
HBRUSH hbrbkgnd;
static COLORREF c;
static BYTE r,g,b;
switch(Message)
{
case WM_TIMER:
if(IdTimer==LOWORD(wParam))
{
r=(BYTE)(rand()%256);
g=(BYTE)(rand()%256);
b=(BYTE)(rand()%256);
c=RGB(r,g,b);
InvalidateRect(hwnd,NULL,TRUE);
UpdateWindow(hwnd);
}
break;
case WM_PAINT:
hdc=BeginPaint(hwnd,&ps);
hbrbkgnd=CreateSolidBrush(c);
SelectObject(hdc,hbrbkgnd);
GetClientRect(hwnd,&rclient);
FillRect(hdc,&rclient,hbrbkgnd);
DeleteObject(hbrbkgnd);
EndPaint(hwnd,&ps);
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IdYes:
quit=TRUE;
MessageBox(hwnd,TEXT("回答正确,太太太好了!"),TEXT("宝贝"),MB_ICONEXCLAMATION|MB_OK);
SendMessage(hwnd,WM_CLOSE,0,0);
break;
case IdNo:
MessageBox(hwnd,TEXT("回答错误哦,我很生气呢!"),TEXT("宝贝"),MB_ICONEXCLAMATION|MB_OK);
break;
}
break;
case WM_SIZE:
case WM_MOVE:
SetWindowPos(hwnd,HWND_TOPMOST,x,y,Width,Height,SWP_SHOWWINDOW);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_CLOSE:
if(quit)
{
KillTimer(hwnd,IdTimer);
DestroyWindow(hwnd);
}
break;
case WM_CREATE:
CreateWindow(TEXT("Static"),
TEXT("请回答:做我女朋友好吗?"),
WS_CHILD|WS_VISIBLE|SS_CENTER,
200,
200,
240,
20,
hwnd,
(HMENU)IdStatic,
hinst,
NULL
);
hyes=CreateWindow(TEXT("Button"),
TEXT("好"),
WS_CHILD|WS_VISIBLE|BS_CENTER,
270,
230,
45,
20,
hwnd,
(HMENU)IdYes,
hinst,
NULL
);
hno=CreateWindow(TEXT("Button"),
TEXT("不好"),
WS_CHILD|WS_VISIBLE|BS_CENTER,
325,
230,
45,
20,
hwnd,
(HMENU)IdNo,
hinst,
NULL
);
SetTimer(hwnd,IdTimer,Tick,NULL);
break;
default:
return DefWindowProc(hwnd,Message,wParam,lParam);
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
WNDCLASSEX wc;
HWND hwnd;
MSG msg;
hinst=hInstance;
srand(time(NULL));
memset(&wc,0,sizeof(wc));
wc.cbSize=sizeof(WNDCLASSEX);
wc.lpfnWndProc=WndProc;
wc.hInstance=hInstance;
wc.hCursor=LoadCursor(NULL,IDC_ARROW);
wc.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);
wc.lpszClassName=TEXT("WindowClass");
wc.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wc.hIconSm=LoadIcon(NULL,IDI_APPLICATION);
if(!RegisterClassEx(&wc))
{
MessageBox(NULL,TEXT("窗口注册失败!"),TEXT("错误"),MB_ICONEXCLAMATION|MB_OK);
return 0;
}
GetWindowRect(GetDesktopWindow(),&rdesk);
x=(rdesk.right-Width)/2;
y=(rdesk.bottom-Height)/2,
hwnd = CreateWindowEx(WS_EX_TOPMOST,
TEXT("WindowClass"),
TEXT("I Love You"),
WS_THICKFRAME|WS_VISIBLE,
x,
y,
Width,
Height,
NULL,NULL,hInstance,NULL);
if(NULL==hwnd)
{
MessageBox(NULL,TEXT("窗口创建失败!"),TEXT("错误!"),MB_ICONEXCLAMATION|MB_OK);
return 0;
}
while(GetMessage(&msg,NULL,0,0)>0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
截图
⑧ c语言表白程序源代码
楼主我都帮你弄成功了,也不上来给我最佳答案啊。。。C++代码,纯粹是凑图形的呵呵#inclu