#include
void convert(int n)
{
int i;
if ((i=n/10)!=0)
convert(i);
putchar(n%10+'0');
}
int main()
{
int number;
printf("\nInput an integer:");
scanf("%d",&number);
printf("Output:");
if ...
分类:
编程语言 时间:
2015-05-14 10:02:06
阅读次数:
145
使用标准输入输出库函数时要用到 “stdio.h”文件,因此源文件开头应有以下预编译命令:1 #includestdio是standard input&outupt的意思。考虑到printf和scanf函数使用频繁,系统允许在使用这两个函数时可不加。putchar 函数(字符输出函数)putchar...
分类:
其他好文 时间:
2015-05-13 07:37:53
阅读次数:
107
#include void print( int val)
{
int tmp = val/10;
if( tmp != 0)
{
print(tmp); }
putchar( val % 10 + '0');
}int main()
{
int val = 1234;
print(val);
putch...
分类:
其他好文 时间:
2015-05-09 17:36:27
阅读次数:
119
这应该算是最简单的大数题了。。。目的就是为了让你知道char的输入输出比int快很多,还学会了getchar(),putchar()。
#include
#define MAX 1000002
char num[MAX],num1[MAX];
int main(){
int n,i;
scanf("%d",&n);
getchar();
for(i=1;i<=n;i++){
num...
分类:
其他好文 时间:
2015-05-09 11:46:05
阅读次数:
96
分析:k_d树的模版题,参考了别人的写的;划分的时候采用坐标跨度作为分割依据的效率略比采用树的深度作为划分依据的高;nth_element函数比sort函数的效率高;全部采用getchar和putchar效率也能提高一些。
#include
#include
using namespace std;
struct POINT
{
int x,y;
};
struct K_D_Node
{...
分类:
其他好文 时间:
2015-05-08 13:07:52
阅读次数:
119
这是原来的代码:#include int main(){ FILE * fp; int ch; fp = fopen("d:\\aaaaa\\1.txt","r"); while (!feof(fp)) { ch = getc(fp); putchar(ch); } fclose(fp); re.....
分类:
其他好文 时间:
2015-05-08 12:31:17
阅读次数:
166
高中的时候做的,前两天看了看,挺好玩的。/***正弦函数图像***/
#include<stdio.h>
#include<math.h>
intmain(void)
{
doubley;
unsignedm,i;
for(y=1;y>=0;y-=0.1)
{
m=asin(y)*10;
for(i=0;i<m;i++)
putchar(‘‘);
putchar(‘*‘);
for(;i<31-..
分类:
其他好文 时间:
2015-04-29 17:37:49
阅读次数:
158
借助于getchar 与putchar 函数,可以在不了解其它输入/输出知识的情况下编写出数量惊人的有用的代码。最简单的例子就是把输入一次一个字符地复制到输出,其基本思想如下:读一个字符while (该字符不是文件结束指示符)输出刚读入的字符读下一个字符将上述基本思想转换为C语言程序为:#inclu...
分类:
其他好文 时间:
2015-04-29 16:59:59
阅读次数:
136
In Keil C, it is necessary to implement char putchar(char c), or the powerful function printf would not work.
We should notice in here : new line command for serial output be "\r\n" (line feed:LF,...
分类:
其他好文 时间:
2015-04-29 07:18:43
阅读次数:
128
1,字符串数组中\0的重要性,如果要求打印字符串,会从当前字符开始一直到\0结束。2,字符串处理函数 字符处理函数putchar一次只能输出一个字符 getchar 等待用户输入一个字符 可以读取空格 tab健等 strlen 返回一个字符串的字符长度 在64位环境下一个中文占三个字符 st...
分类:
移动开发 时间:
2015-04-25 00:07:48
阅读次数:
143