![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C语言机试
九花玉露丸
渣硕!!!
展开
-
输出一句话中最长的单词---跨专业渣渣准备机试系列(1)!!!
//find the longest word#include<stdio.h>#include<string.h>#define max 100int main(){ char str[max]; memset(str,'\0',sizeof(str)); gets(str); int m=strlen(str);// str[m]=' '; int i=0,j=0,ma...原创 2018-03-17 21:13:04 · 192 阅读 · 0 评论 -
编写程序可计算如下分段函数:--跨专业渣渣准备机试系列(2)!!!
#include<stdio.h>#include<math.h>#define PI 3.1415926573double f(double x){ double y; if(x>0) { y=(sqrt(x)+exp(x))/(5*x+5); } else { y=(2/3+sqrt(3)/2)*fabs(x); }}int main(){ double x;...原创 2018-03-18 15:02:00 · 701 阅读 · 0 评论 -
ASCII码值从小到大排序--跨专业渣渣准备机试系列(3)!!!
#include<stdio.h>#include<string.h>#define max 100//题目中对字符串长度没有做要求进行宏定义便于修改 void charsort(char* str)//排序函数 { /*根据ASCII码的大小进行冒泡排序*/ int longth=strlen(str); char tmp; int i,j; for(i=0;i<l...原创 2018-03-18 15:03:39 · 2745 阅读 · 0 评论 -
编写程序显示2-1000之间的完数-跨专业渣渣准备机试系列(4)!!!
#include<stdio.h>#include<math.h>#include<string.h>int comnumber(int s){ int k=2; int sum=1; for(;k<=s-1;k++)//注意质数和因子的区别 { if(s%k==0) sum+=k; } if(sum==s) return 1; else re...原创 2018-03-18 15:05:18 · 511 阅读 · 0 评论