scanf

阅读 56

2023-06-18


// scanfXS.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

int main(int argc, char* argv[])
{
	int i;
	char buff[256];

	printf("please input an int number:\n");
	scanf("%x",&i);
    printf("i=%x\n",i);
	printf("please input a  string:\n");
	scanf("%s",buff);
    printf("string=%s\n",buff);

	return 0;
}
/*
please input an int number:
0xad
i=ad
please input a  string:
qwert321
string=qwert321
Press any key to continue
please input an int number:
ad
i=ad
please input a  string:
asdfg
string=asdfg
Press any key to continue
*/



精彩评论(0)

0 0 举报