<cstdlib> stdlib.h头文件

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	
	#if 0
	char buf[256];
	printf("Enter a value\n");
	fgets(buf, 256, stdin);
	printf("You input value to float %f, to int %d, to long %ld, to long long %lld\n", atof(buf), atoi(buf), atol(buf), atoll(buf));
	#endif
	
	#if 0
	char strbuf[256];
	char* strend;
	printf("Enter string value list\n");
	fgets(strbuf, 256, stdin);
	printf("You inpu value to float %f \n", strtof(strbuf, &strend));
	printf("Nest value is %f\n", strtof(strend, NULL));
	#endif
	
	#if 0
	// Generate secret number between 1 and 10
	srand(time(NULL));
	int ran = rand() % 10 +1;
	printf("Rand value is %d \n", ran);
	#endif
	
	#if 0
	char* path;
	path = getenv("PATH");
	if (NULL != path)
		printf("Current path is %s \n", path);
		
	#endif
	
	#if 0
	printf("Abs funciton of 32 is %d, -10 is %d\n", abs(32), abs(-10));
	#endif
	
	#if 0
	div_t divResult;
	divResult = div(35, 6);
	printf("Div funciton 35/7 result %d, remainder %d\n", divResult.quot, divResult.rem);
	#endif

	#if 1
	printf("Please input string length you what\n");
	char strbuf[256];
	fgets(strbuf, 256, stdin);
	char* memAlloc = (char*)malloc(atoi(strbuf));
	memAlloc = "erichao";
	printf("Mem context is %s\n", memAlloc);
	#endif
	
	system("pause");
	return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值