Ⅰ 求编写一个表白程序
JAVA
传说中规范的爱情代码(2010-11-10 21:37:36)
转载
标签:it
private final static DEPOSIT = 100000;
private final static FELLING = 8;
public void love(boy, girl) {
Boolean isMarried = false;
if(boy.有房() &&boy.有车()) {
doMarry(boy, girl);
isMarried = true;
} else if(girl.愿意等()) {
while(!(boy.赚钱 > DEPOSIT && girl.感情 > FELLING)) {
for(int day=1; day <=365; day++) {
if( day == 情人节 ) {
if(boy.givegirl(玫瑰)) {
girl.感情++;
} else {
girl.感情--;
}
}
if(day == girl.生日) {
if( boy.givegirl(玫瑰) )
{
girl.感情++;
}
else {
girl.感情--;
boy.拼命赚钱();
}
}
}
if(boy.有房() && boy.有车()) {
doMarry(boy, girl);
isMarried = true;
break;
}
年龄++;
girl.感情--;
}
}
if(!IsMarried) {
girl.goto(another_boy);
}
private void doMarry(boy, girl) {
boy.set(nothing);
girl.嫁给(boy);
}
Ⅱ 求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语言如何编我喜欢你
int main(){ char *lovername = "lucy"; char name[128] = {0}; do { memset(name,0x00,sizeof(name)); printf("我喜欢谁请输入她的名字 ")。
Ⅳ QQ怎么用ALT+编码打“我喜欢你”
用的是汉字的内码
下载一个ultraEdit
在ultraEdit中输入一个汉字,然后Ctrl+H,
就会看到汉字的内码的16进制,用计算器转换成10进制就可以用小键盘输入了。
汉字为双码,所以每个汉字是2组码,4个字符,别记错哦
例子:
ultraEdit中新建一个文档
输入一个“赵”字
Ctrl+H显示“D5D4”
程序->附件->计算器
计算器->察看->科学型,点十六进制,输入“D5D4”,
再点“十进制”,显示“54740”
Alt+54740 即“赵”
52946 我
53170 喜
48054 欢
50403 你
Ⅳ 如何用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程序
Ⅵ 【VB全局热键】按下F1执行msgbox“我喜欢你”代码代码!!
'============主窗体代码如下:===============
Option Explicit
'程序启动时注册功能热键F1
Private Sub Form_Load()
Dim Modifiers As Long
preWinProc = GetWindowLong(Me.hWnd, GWL_WNDPROC)
SetWindowLong Me.hWnd, GWL_WNDPROC, AddressOf WndProc
uVirtKey = vbKeyF1 '全局热键F1
RegisterHotKey Me.hWnd, 1, Modifiers, uVirtKey
End Sub
'当程序被关闭时,取消已经注册的热键
Private Sub Form_Unload(Cancel As Integer)
SetWindowLong Me.hWnd, GWL_WNDPROC, preWinProc
UnregisterHotKey Me.hWnd, uVirtKey '取消系统级热键,释放资源
End '终止程序运行
End Sub
'================添加一个标准模块,代码如下=============
Option Explicit
'在窗口结构中为指定的窗口设置信息
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
'从指定窗口的结构中取得信息
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
'运行指定的进程
Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'向系统注册一个指定的热键
Public Declare Function RegisterHotKey Lib "user32" (ByVal hWnd As Long, ByVal ID As Long, ByVal fsModifiers As Long, ByVal vk As Long) As Long
'取消热键并释放占用的资源
Public Declare Function UnregisterHotKey Lib "user32" (ByVal hWnd As Long, ByVal ID As Long) As Long
'上述五个API函数是注册系统级热键所必需的,具体实现过程如后文所示
'热键标志常数,用来判断当键盘按键被按下时是否命中了我们设定的热键
Public Const WM_HOTKEY = &H312
Public Const GWL_WNDPROC = (-4)
'定义系统的热键,原中断标示,被隐藏的项目句柄
Public preWinProc As Long, MyhWnd As Long, uVirtKey As Long
'热键拦截过程
Public Function WndProc(ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If Msg = WM_HOTKEY Then '如果拦截到热键标志常数
If wParam = 1 Then '如果是我们的定义的热键...
HideDone '执行隐藏鼠标所指项目
End If
End If
'如果不是热键,或者不是我们设置的热键,交还控制权给系统,继续监测热键
WndProc = CallWindowProc(preWinProc, hWnd, Msg, wParam, lParam)
End Function
'最关键的项目隐藏过程
Public Sub HideDone()
MsgBox "我喜欢你" '如果是F1热键激活,显示
End Sub
Ⅶ 我爱你编程代码是什么
如下:
#include<stdio.h>
int main()
{
printf("我爱你");
return 0;
}
我爱你相关简介:
我爱你,汉语词汇,一般用于一人向爱慕的另一个人的感情表达,也可以用于亲人间,是一个人对另一个人的感情表达。也可以用于对宠物、物品等寄托了浓重感情的事物的表达,可以男生对女生说,可以女生对男生说,也可以女生对女生说,也可以男生对男生说。
Ⅷ 用while循环100次说我喜欢你代码怎么写
#include <stdio.h>
int main()
{ int n=100;
while(n--) printf("我喜欢你 ");
return 0;
}
Ⅸ C语言编程 我喜欢你,但是我喜欢你 这几个字不能出现
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
int main(void)
{
char str[12];
wchar_t wstr[] = { 0x6211, 0x559c,0x6b22,0x4f60,0 };
setlocale(LC_ALL, "");
wcstombs(str, wstr, sizeof(str)/sizeof(char));
printf("%s", str);
getchar();
return 0;
}
Ⅹ 我也喜欢你怎么用C语言编写
intmain()
{
printf("我也喜欢你! ");
return0;
}