![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C语言
文章平均质量分 64
编程开发专栏
这个作者很懒,什么都没留下…
展开
-
把整数转换为字符
#include void convert(long n){ long i; if((i=n/10)!=0) convert(i); putchar(n%10+'0');}void main(){ long number; scanf("%ld",&number); if(number<0) { putchar('-'); number=-number; }原创 2013-04-17 13:45:09 · 545 阅读 · 0 评论 -
输入任意一个年份和月份,输出该月份的公历日历
#include "iostream" using namespace std; int main() { int m,d,monthmax,y; while(1) { cout<<"请输入年份:"; cin>>y; cout<<"请输入月份:"; cin>>m;原创 2013-04-17 15:49:05 · 2353 阅读 · 0 评论 -
十进制转成n进制
# include # include void fun(int n,int i){ int a[20],j; for(j=0;n;j++) { a[j]=n%i; n/=i; } for(;j;j--) printf("%d",a[j-1]);}main(){ int x,num; printf("\nPlease enter a原创 2013-04-17 13:56:21 · 992 阅读 · 0 评论 -
C++制作的ATM取款机
#include #include #include //清屏函数头文件using namespace std;double total=1000;void welcome(){ cout<<"------------------------------ATM自动取款系统----------------------------------\n"; cout<<"\n请插入你的磁卡原创 2013-04-17 13:55:22 · 1501 阅读 · 0 评论 -
简易通讯录(用链表完成)
#include #include /*与malloc.h差不多*/#include #define maxlen 100struct persons{ char name[10]; /*定义结构体数组用于缓存数据*/ char addr[20]; char phnum[10]; }persons[maxlen];;;;typedef struct lnode{ /*原创 2013-04-17 13:52:55 · 727 阅读 · 0 评论 -
用行指针输出某一行的全部元素
#include int *fun(int (*p)[4],int m){ int *pt; pt=*(p+m); return pt; } void main(){ int m,i; int *p; int a[][4]={1,2,3,4,5,6,7,8,9,10,11,12}; scanf("%d",&m); p=fun(a,m); for(i=0;i<4;i+原创 2013-04-17 13:49:57 · 971 阅读 · 0 评论 -
递归求和
#include int sum(int n){ if(n==1) return n; return n+sum(n-1);}void main(){ int n,c; scanf("%d",&n); c=sum(n); printf("%d\n",c);}方法二:#include int sum(int a,int b){ if(a==b) return原创 2013-04-17 13:46:51 · 609 阅读 · 0 评论 -
座位调整
题目描述: 百度办公区里到处摆放着各种各样的零食。百度人力资源部的调研发现,员工如果可以在自己喜欢的美食旁边工作,工作效率会大大提高。因此,百度决定进行一次员工座位的大调整。 调整的方法如下: 1 . 首先将办公区按照各种零食的摆放分成 N 个不同的区域。(例如:可乐区,饼干区,牛奶区等等)。 2 . 每个员工对不同的零食区域有不同的喜好程度(喜好程度度的范围为 1 — 100 的原创 2013-04-17 14:25:12 · 927 阅读 · 0 评论 -
将阿拉伯数组转换成为罗马数字
将大于0小于1000的阿拉伯数字转换为罗马数字。阿拉伯数字与罗马数字的对应关系如下:1 2 3 4 5 ……I II III IV V ……*问题分析与算法设计题目中给出了阿拉伯数字与罗马数字的对应关系,题中的数字转换实际上就是查表翻译。即将整数的百、十、个位依次从整数中分解出来,查找表中相应的行后输出对应的字符。*程序与程序设计#include void main() {原创 2013-04-17 14:18:54 · 2791 阅读 · 0 评论 -
万年历系统
# include int leapyear(int year){ if((year%4 == 0 &&year%100 != 0)||(year%400 == 0)) return(1); else return(0);}int week(int y,int m,int d){ int sum=0,i,x; int a[12]={31,28,31,30,31,30,31原创 2013-04-17 13:53:32 · 535 阅读 · 0 评论 -
指针数组和行指针作为形参时的区别
用指针数组作为形参时的表示方法:#include void fun(int *p[3],int n){ int i,j; for(i=0;i<3;i++) for(j=0;j<n;j++) printf("%d ",*(*(p+i)+j)); printf("\n");}void main(){ int a[3][4]={1,2,3,4,5,6,7,8,9,10,11原创 2013-04-17 13:51:21 · 1784 阅读 · 0 评论 -
职工治理系统
/*八、简单的职工治理系统1.问题描述 对单位的职工进行治理,包括插入、删除、查找、排序等功能。2.要求 职工对象包括姓名、性别、出生年月、工作年月、学历、职务、住址、电话等信息。(1)新增一名职工:将新增职工对象按姓名以字典方式职工治理文件中。(2)删除一名职工:从职工治理文件中删除一名职工对象。(3)查询:从职工治理文件中查询符合某些条件的职工。(4)修改:检索某个职工对象原创 2013-04-17 13:54:29 · 812 阅读 · 1 评论 -
密码发生器(蓝桥杯2012)
描述 在对银行账户等重要权限设置密码的时候,我们常常遇到这样的烦恼:如果为了好记用生日吧,容易被破解,不安全;如果设置不好记的密码,又担心自己也会忘记;如果写在纸上,担心纸张被别人发现或弄丢了... 这个程序的任务就是把一串拼音字母转换为6位数字(密码)。我们可以使用任何好记的拼音串(比如名字,王喜明,就写:wangximing)作为输入,程序输出6位数字。 变换的过程如下:原创 2013-04-17 15:56:46 · 1453 阅读 · 0 评论