用c语言对话
❶ 怎么用c语言编写对话的形式急啊!!!!谢谢啦!!1
用 if 判断条件
#include <stdio.h>
void main()
{
int a;
printf("1+1=?");
scanf("%d",&a);
if(a==2)//当用户输入的数值是2是就执行if下以行,否则的话就执行else后面的语句
printf("Very Good\n");
else
printf("ERROR\n");//error是错误的意思
}
要按你的意思的话,就要用if判断语句,
当怎么样时....就怎么样.... 否则就怎么样...
❷ 用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 != '