求一个用于表白的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("遇到你\n我才发现\n曾经所有的条件\n似乎都成了我等你的借口\n\n");
printf("我对你的感情已经决堤\n所以\n请允许我,从今往后映入你\n明媚的眼\n");
printf("我\n想和你\n耳鬓厮磨,相濡以沫!");
printf("答应我吧!\n输入yes,你可以看到我的真心\n");
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('\n');
}
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;
}
运行效果:
扩展资料:
printf函数使用注意事项
1、域宽
%d:按整型数据的实际长度输出。
如果想输出指定宽度可以指定域宽,%md--&gt;m域宽,打印出来以后,在控制台上,显示m位;
如果我们要打印的数的位数如果超过我们设定m则原样输出;
如果我们要打印的数的位数如果小于我们设定的位数,则补空白,具体如下:
如果m为正数,则左对齐(左侧补空白);
如果m为负数,则右对齐(右侧补空白)。
2、转义字符
如果想输出字符"%",则应该在“格式控制”字符串中用连续两个%表示。
如:printf("%f%%",1.0/3);输出结果:0.333333%。
#include<stdio.h>
#include<math.h>
#include<windows.h>
// 获取控制台窗口句柄 微软官方网站的程序 直接拿来用了
HWND GetConsoleHwnd(void)
{
#define MY_BUFSIZE 1024 // Buffer size for console window titles.
HWND hwndFound; // This is what is returned to the caller.
char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated
char pszOldWindowTitle[MY_BUFSIZE]; // Contains original
GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);//获取控制台标题存入pszOldWindowTitle中
//设置控制台的标题为 时间数 进程ID
wsprintf(pszNewWindowTitle,"%d/%d",//把获取的数目,和当前进程ID输出到缓冲区pszNewwindowtitle中
GetTickCount(),//用于获取操作系统启动后的毫秒数
GetCurrentProcessId());//获取当前进程ID
SetConsoleTitle(pszNewWindowTitle);//更改控制台的标题为新内容
Sleep(40);
hwndFound=FindWindow(NULL, pszNewWindowTitle);//获取控制台的HWND号
SetConsoleTitle(pszOldWindowTitle);//更改控制台的标题为原始内容
return(hwndFound);//返回句柄
}
void drawXY()//绘制X和Y轴
{
HWND hWnd=GetConsoleHwnd();//获取控制台窗口句柄,用于设置画笔颜色
HDC hDC=GetDC(hWnd);
COORD dwSize;//记录窗体大小,用于设定坐标轴远点
HPEN hNewPen=CreatePen(PS_SOLID,1,RGB(255,0,0));//创建画笔对象
HPEN hOldPen=(HPEN)SelectObject(hDC,hNewPen);//选取画笔对象进行绘图
CONSOLE_SCREEN_BUFFER_INFO bInfo; // 窗口信息
HANDLE Hout=GetStdHandle(STD_OUTPUT_HANDLE);//获取控制台句柄
GetConsoleScreenBufferInfo(Hout, &bInfo );//获取控制台信息
dwSize=bInfo.dwMaximumWindowSize ;//获取窗口大小,此时获得的是字符模式下
//从字符到图像放大坐标轴8倍
dwSize.X *=8;
dwSize.Y*=8;
SetBkMode(hDC, TRANSPARENT);SetTextColor(hDC,255*255);
//绘制X轴各个特殊坐标
TextOut(hDC,dwSize.X-15,dwSize.Y/2-15,"X",1);
//Arc(hDC,100,100,300,300,350,500,350,500);//画圆 其中hDC表示画图句柄,100,100,300,300表示所使用的矩形区域,350,500表示画弧线的起点,350,500表明画弧线的终点 ;
//绘制Y轴各个特殊坐标
TextOut(hDC,dwSize.X/2,0,"Y",1);
MoveToEx(hDC,0,dwSize.Y /2,NULL);
LineTo(hDC,dwSize.X,dwSize.Y/2);
MoveToEx(hDC,dwSize.X/2,0,NULL);
LineTo(hDC,dwSize.X/2,dwSize.Y);
ReleaseDC(hWnd,hDC);
}
void draw(double p)
{
int i;
double x,y;
HWND hWnd=GetConsoleHwnd();//获取控制台窗口句柄,用于设置画笔颜色
HDC hDC=GetDC(hWnd);
COORD dwSize;//记录窗体大小,用于设定坐标轴远点
HPEN hNewPen=CreatePen(PS_SOLID,1,RGB(255,0,0));//创建画笔对象
HPEN hOldPen=(HPEN)SelectObject(hDC,hNewPen);//选取画笔对象进行绘图
CONSOLE_SCREEN_BUFFER_INFO bInfo; // 窗口信息
HANDLE Hout=GetStdHandle(STD_OUTPUT_HANDLE);//获取控制台句柄
GetConsoleScreenBufferInfo(Hout, &bInfo );//获取控制台信息
dwSize=bInfo.dwMaximumWindowSize ;//获取窗口大小,此时获得的是字符模式下
//从字符到图像放大坐标轴8倍
dwSize.X *=8;
dwSize.Y*=8;
//MoveToEx(hDC,0,dwSize.Y/2,NULL);
for(i=-180;i<=180;i++)
{
x=16*pow(sin(i*3.1415926/180),3.0)*p;
y=(13*cos(i*3.1415926/180)-5*cos(2*i*3.1415926/180)-2*cos(3*i*3.1415926/180)-cos(4*i*3.1415926/180))*p;
x=(x+16)*dwSize.X/32/2+dwSize.X/4;
y=-y/16*dwSize.Y/2.3+dwSize.Y/2;
x=x;
y=y;
MoveToEx(hDC,x,y,NULL);
LineTo(hDC,x+1,y+1);
}
}
void main()
{
double p;
drawXY();
for(p=0.6;p<=1;p=p+0.01)
draw(p);
system("PAUSE");
}
老哥……有简单点的吗?………😳
要多简单
语言与c++的区别有很多:
1,全新的程序程序思维,c语言是面向过程的,而c++是面向对象的。
====
c++也可以面向过程。面向对象只是一种思想,
2,c语言有标准的函数库,它们松散的,只是把功能相同的函数放在一个头文件中;而c++对于大多数的函数都是有集成的很紧密,特别是c语言中没有的c++中的api是对window系统的大多数api有机的组合,是一个集体。但你也可能单独调用api。
====
实在不明白你这个是什么意思。
3,特别是c++中的图形处理,它和语言的图形有很大的区别。c语言中的图形处理函数基本上是不能用在中c++中的。c语言标准中不包括图形处理。
====
你没用过c语言处理过图形吧?恰好相反,大部分图形api都是c的。
4,c和c++中都有结构的概念,但是在c语言中结构只有成员变量,而没成员方法,而在c++中结构中,它可以有自己的成员变量和成员函数。但是在c语言中结构的成员是公共的,什么想访问它的都可以访问;而在vc++中它没有加限定符的为私有的。
====
c结构体也是可以函数指针,也是可以针对函数指针进行调用。应用“宏”,甚至可以对结构体进行构造工作。
4,c语言可以写很多方面的程序,但是c++可以写得更多更好,c++可以写基于dosr程序,写dll,写控件,写系统。
====
c/c++逻辑上就是等价的。没有什么谁做得好,做的不好的问题。c++能做到的,c也能做到。要知道,c++编译器就是c语言写的。
5,c语言对程序的文件的组织是松散的,几乎是全要程序处理;而c++对文件的组织是以工程,各文件分类明确。
====
工程主要看开发环境,并不是看语言。看你也没有真正用vc开发过c程序。
6,c++中的ide很智能,和vb一样,有的功能可能比vb还强。
====
ide性能只看开发环境,并不看语言。c也可以有很好的ide。
7,c++对可以自动生成你想要的程序结构使你可以省了很多时间。有很多可用的工具如加入mfc中的类的时候,加入变量的时候等等。
====
这些都是ide的特性,不是语言特性
8,c++中的附加工具也有很多,可以进行系统的分析,可以查看api;可以查看控件。
====
这些也是ide特性,不是语言特性
9,调试功能强大,并且方法多样。
====
这也是ide特性,不是语言特性。
#include<math.h>
#include<windows.h>
#include<time.h>
#define U 0.1
#define V 0.053
void SetColor(unsigned short ForeColor,unsigned short BackGroundColor)
{
HANDLE hCon=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hCon,(ForeColor%16)|(BackGroundColor%16*16));
}
int main()
{
int i,s=0,t,a=10,b=11,c=12,d=13,e=14;
int z[] = {32,32,206,210,207,178,187,182,196,227,33,32,32};
float x,y;
srand(time(NULL));
for(y=1.3;y>=-1.1;y-=U)
{
for(x=-2;x<1.4;x+=V)
{
if((((x*x+y*y-1)*(x*x+y*y-1)*(x*x+y*y-1)-x*x*y*y*y)<=0))
{
if(y>=1.3-10*U||y<=1.3-11*U)
{
s++;
if(s%4==1){SetColor(a,0);printf("l");}
if(s%4==2){SetColor(e,0);printf("o");}
if(s%4==3){SetColor(c,0);printf("v");}
if(s%4==0){SetColor(d,0);printf("e");}
}
else
{
for(i = 0;i < 42;i++)
{
if(i<=14||i>=28)
{
s++;
if(s%4==1){SetColor(a,0);printf("l");}
if(s%4==2){SetColor(e,0);printf("o");}
if(s%4==3){SetColor(c,0);printf("v");}
if(s%4==0){SetColor(d,0);printf("e");}
}
else
{
SetColor(b,0);
printf("%c", z[i-15]);
Sleep(50);
}
}
break;
}
}
else
printf(" ");
Sleep(1);
}
printf("\n");
}
printf("按任意键继续!");
getchar();
while(1)
{
system("cls");
t=a;a=b;b=c;c=d;d=e;e=t;
for(y=1.3;y>=-1.1;y-=U)
{
for(x=-2;x<1.4;x+=V)
{
if((((x*x+y*y-1)*(x*x+y*y-1)*(x*x+y*y-1)-x*x*y*y*y)<=0))
{
if(y>=1.3-10*U||y<=1.3-11*U)
{
s++;
if(s%4==1){SetColor(a,0);printf("l");}
if(s%4==2){SetColor(b,0);printf("o");}
if(s%4==3){SetColor(c,0);printf("v");}
if(s%4==0){SetColor(d,0);printf("e");}
}
else
{
for(i = 0;i < 42;i++)
{
if(i<=14||i>=28)
{
s++;
if(s%4==1){SetColor(a,0);printf("l");}
if(s%4==2){SetColor(b,0);printf("o");}
if(s%4==3){SetColor(c,0);printf("v");}
if(s%4==0){SetColor(d,0);printf("e");}
}
else
{
SetColor(e,0);
printf("%c", z[i-15]);
}
}
break;
}
}
else
printf(" ");
}
printf("\n");
}
Sleep(1000);
system("cls");
}
}
首先打出名字的缩写哦!(前三个字母,共有六个字母)
然后再打出三个数字哦!(这是后三个字母)
最后按Enter(回车)就好了,就可以看见了
出来后还能打出一个人的名字缩写,然后直接按Enter(回车)就好了!
#include<iostream>
using namespace std;
int main()
{
char a,b,c,d,e,f;
cin>>d>>e>>f>>a>>b>>c;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<" "<<d<<" "<<e<<" "<<f<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<endl;
char g,h,i;
cin>>g>>h>>i;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<" "<<g<<" "<<h<<" "<<i<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<endl;
cout<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<" " <<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<a<<b<<c<<" "<<endl;
return 0;
}