当前位置:首页 » 编程语言 » c语言弹窗小程序
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

c语言弹窗小程序

发布时间: 2022-10-23 18:56:36

① 用c语言写一个自动关机的小程序 ,可以跳出一个对话框,让输入关机时间的

#include<stdio.h>
#include<windows.h>
#include<string.h>
int main(void)
{

system("shutdown -s -t 5");
printf("未经本人允许,竟然私自‘偷’看我的U盘文件,将受到惩罚!!!\n");
char n[50],c[50];
printf("输入:我爱你 ,否则5秒后自动关机!!!嘿嘿!!!\n");
strcpy(c,"我爱你");
while(1)
{
printf("输入:");
scanf("%s",n);
if(!strcmp(n,c))
{
system("shutdown -a");
printf("多谢配合!!!嘿嘿!!!\n");
break;
}
}

return 0;

}

这是我编辑放在U盘里的一个小恶搞,再打exe文件名取得猥琐点。。。有兴趣可以参考下,需要实用的话,可以自行更改下参数。
另外说明下:让输入关机时间,好像语法中实现不了。当然,有不排除有高手能搞定。

② c语言代码怎么变成小程序啊

LZ解决没有? 举个例子: 用VC++6.0编译后生成的Debug文件夹下有一个*.exe的文件 然后剪切或者复制出来,用cmd就可以调用,但是有点小问题需要注意下,LZ自己看下吧,到时候很容易解决的

③ C语言编写一个小程序

#include<stdio.h>
#include<time.h>
intmain()
{
inta,b;
srand(time(NULL));
a=rand();
scanf("%d",&b);
a==b?printf("true"):printf("false");
return0;
}

//运行示例:

④ 用c语言如何实现弹除对话框

#include

#include

char format[]="%s%s ";

char hello[]="Hello";

char world[]="world";

HWND hwnd;void main(void)

asm

//push NULL

//call dword ptr GetMoleHandle

//mov hwnd,eax push MB_OK mov eax,offset world push eax mov eax,offset hello push eax push 0//说明此处不能将前面注释掉代码处得到的hwnd压栈,否则对话框弹不出来。

call dword ptr MessageBox

}

}

WINDOWS程序MessagBox

WINDOWS或控制台 assert

C/C++ code

// crt_assert.c

// compile with: /c

#include <stdio.h>

#include <assert.h>

#include <string.h>

void analyze_string( char *string ); // Prototype

int main( void )

{

char test1[] = "abc", *test2 = NULL, test3[] = "";

printf ( "Analyzing string '%s' ", test1 ); fflush( stdout );

analyze_string( test1 );

printf ( "Analyzing string '%s' ", test2 ); fflush( stdout );

analyze_string( test2 );

printf ( "Analyzing string '%s' ", test3 ); fflush( stdout );

analyze_string( test3 );

}

// Tests a string to see if it is NULL,

// empty, or longer than 0 characters.

void analyze_string( char * string )

{

assert( string != NULL ); // Cannot be NULL

assert( *string != '' ); // Cannot be empty

assert( strlen( string ) > 2 ); // Length must exceed 2

}

(4)c语言弹窗小程序扩展阅读:

#include <windows.h>

#include <Commdlg.h>

#include <stdio.h>

// 返回值: 成功 1, 失败 0

// 通过 path 返回获取的路径

int FileDialog(char *path)

{

OPENFILENAME ofn;

ZeroMemory(&ofn, sizeof(ofn));

ofn.lStructSize = sizeof(ofn); // 结构大小

ofn.lpstrFile = path; // 路径

ofn.nMaxFile = MAX_PATH; // 路径大小

ofn.lpstrFilter = "All*.*Text*.TXT"; // 文件类型

ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;

return GetOpenFileName(&ofn);

}

int main(char argc, char *argv[])

{

char szFile[MAX_PATH] = {0};

if(FileDialog(szFile))

{

puts(szFile);

}

getchar();

return 0;

}

⑤ c语言一个窗口小程序问题 MSG 的问题代码如下:

将第26行的 while(GetMessage(&msg,(HANDLE)NULL,(UINT)NULL,(UINT)NULL))
改为 while(GetMessage(&msg,(HWND)NULL,(UINT)NULL,(UINT)NULL))
参数类型错了!

⑥ 用C语言写一个小程序,麻烦大家了

//记得多给点分哦,很难写的。
//C
#include<stdio.h>
intstrnmerge(char*str,intn,charconst*s1,charconst*s2){
while(n>0){
if(!(*s1)&&!(*s2))break;
if(*s1&&n>0){
*str++=*s1++;
--n;
}
if(*s2&&n>0){
*str++=*s2++;
--n;
}
}
*str='';
}
intmain(){
chars1[]="aaaa";
chars2[]="bbbbbbbbb";
charstr[100];
strnmerge(str,10,s1,s2);
printf("s1=%s ",s1);
printf("s2=%s ",s2);
printf("str=%s ",str);
return0;
}

//C++
#include<iostream>
usingnamespacestd;
intstrnmerge(char*str,intn,charconst*s1,charconst*s2){
while(n>0){
if(!(*s1)&&!(*s2))break;
if(*s1&&n>0){
*str++=*s1++;
--n;
}
if(*s2&&n>0){
*str++=*s2++;
--n;
}
}
*str='';
}
intmain(){
chars1[]="aaaa";
chars2[]="bbbbbbbbb";
charstr[100];
strnmerge(str,10,s1,s2);
cout<<"s1="<<s1<<endl;
cout<<"s2="<<s2<<endl;
cout<<"str="<<str<<endl;
return0;
}

⑦ C语言如何制作无限弹窗代码

方法步骤如下:

1、首先打开计算机,在计算机的桌面上右键点击,选中“文件文档”选项。

⑧ C语言如何弹出提示框

直接调用系统API MessageBox()函数就可以了。

函数原形
int WINAPI MessageBox(HWND hWnd,LPCTSTR lpText,LPCTSTR lpCaption,UINT uType);
参数说明
hWnd: 消息框的拥有窗此参数口。如果为NULL,则消息框没有拥有窗口。
lpText: 消息框的内容。
lpCaption: 消息框的标题。
uType:
指定一个决定对话框的内容和行为的位标志集。此参数可以为下列标志组中标志的组合。指定下列标志中的一个来显示消息框中的按钮以及图标。
MB_OK 默认值。有一个确认按钮在里面。
MB_YESNO 有是和否在里面。
MB_ABORTRETRYIGNORE 有Abort(放弃),Retry(重试)和Ignore(跳过)
MB_YESNOCANCEL 消息框含有三个按钮:Yes,No和Cancel
MB_RETRYCANCEL 有Retry(重试)和Cancel(取消)
MB_OKCANCEL 消息框含有两个按钮:OK和Cancel
当然还有其他标志和返回值, 具体内容参考
https://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx

最后是用系统API时需要包含头文件 windows.h

⑨ 能用C语言弹出一个提示窗口吗

可以

#include "windows.h"
然后用
MessageBox(NULL,"弹出窗口的文本内容","弹出窗口的标题",0);

⑩ 用C语言编写个带弹出窗口的程序

#include <windows.h>

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
MessageBox (NULL, TEXT ("Hello, bccn!"), TEXT ("HelloMsg"), 0) ;

return 0 ;
}