新聞中心
C語言 函數(shù)有哪些 中文翻譯都是什么意思
1.i/o函數(shù)
為上街等地區(qū)用戶提供了全套網(wǎng)頁設計制作服務,及上街網(wǎng)站建設行業(yè)解決方案。主營業(yè)務為成都網(wǎng)站設計、成都網(wǎng)站制作、外貿(mào)網(wǎng)站建設、上街網(wǎng)站設計,以傳統(tǒng)方式定制建設網(wǎng)站,并提供域名空間備案等一條龍服務,秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務。我們深信只要達到每一位用戶的要求,就會得到認可,從而選擇與我們長期合作。這樣,我們也可以走得更遠!
(1)scanf函數(shù):
int
scanf(const
char
*format…..);
從標準輸入流stdin中按格式format將數(shù)據(jù)寫到參數(shù)表中;若操作成功,返回寫到參數(shù)表中的參數(shù)個數(shù),否則返回eof;
注意以下幾點:
①scanf函數(shù)沒有精度控制
如出現(xiàn):
scanf(“%6.2f”,a);
是絕對錯誤的
②在以%c格式輸入字符數(shù)據(jù)時,所有輸入的均為有效字符
如:
scanf(“%c%c%c”,a,b,c);
輸入:d
e
f
則a=’d’,b為空格字符'
',c=’d’
如果以%s讀入字符串,則空格鍵和回車鍵都可以作為輸入結(jié)束的標志
如:
scanf(“%s%s”,p,q);---------p,q均為指針
輸入:hello
world與
hello
world
效果是相同的,p均指向hello這個字符串,q均指向world這個字符串
③如果在格式控制字符串中有非格式字符,則輸入時要照原樣入;
如:
scanf(“%d,%d,%d,”,,b,c);
則輸入時必須加上逗號:5,6,7
④如果同while配合用的話,則需注意去掉回車鍵
如有下面一段程序:
while(scanf(“%d”,n)==1n!=0)
{
char
ch;
scanf(“%c”,ch);
printf(“%c\n”,ch);
}
則輸出結(jié)果是:
2
3
結(jié)果表明ch字符是回車鍵
所以如果要消除影響:
有兩種方法:
1)加上getchar();
while(scanf(“%d”,n)==1n!=0)
{
getchar();
char
ch;
scanf(“%c”,ch);
printf(“%c\n”,ch);
}
2)在while中加上%*c
while(scanf(“%d%*c”,n)==1n!=0)即可
2.數(shù)學函數(shù)
(1)求絕對值
double
fabs(double
);
float
fabsf(float);
long
double
fabsl(long
double);
int
abs(int);
long
int
labs(long
int);
(2)floor函數(shù):返回不大于參數(shù)的整數(shù)
float
floor(float);
double
floor(double);
(3)ceil函數(shù):返回不小于參數(shù)的整數(shù)
float
ceil(float);
double
floor(double);
(4)pow:返回x^y;
double
pow(double
x,double
y);
(5)sqrt:返回x的開方
double
sqrt(double
x);
(6)log2,log10:返回底數(shù)的自然對數(shù)值
double
log2(double
x);
double
log10(double
x);
3.字符串處理函數(shù)
(1)char
*strchr(const
char
*str,int
ch);
返回str中第一次出現(xiàn)字符ch的位置指針,否則返回null;
(2)char
*strstr(const
char
*str1,const
char
*str2);
返回str1中第一次出現(xiàn)str2的位置指針,否則返回null;
(3)int
stricmp(const
char
*str1,const
char
*str2);
忽略字符的大小寫進行比較
(4)int
strncmp(const
char
*str1,const
char
*str2,int
count);
將str1前n個字符與str2的前n個字符進行比較
(5)char
*strncpy(char
*str1,const
char
*str2,int
count);
將str2的前n個字符復制到str1中
(6)char
*strrev(char
*str);
將字符串str逆序,并返回逆置后的結(jié)果
4.常用使用函數(shù)
(1)double
atof(const
char
*str);
將字符串str表示的數(shù)轉(zhuǎn)換成浮點數(shù)
(2)int
atoi(const
char
*str);
將字符串str表示的數(shù)轉(zhuǎn)換成整數(shù)
(3)void
qsort(void
*buf,int
count,int
size,cmp);————count為所需要進行排序的元素個數(shù),size為每個元素所占用的空間
快速排序
c語言怎么翻譯成數(shù)學
1、C語言有現(xiàn)場的常用數(shù)學函數(shù),所在函數(shù)庫為math.h、stdlib.h。
函數(shù)名及解釋:
int abs(int i) 返回整型參數(shù)i的絕對值
double cabs(struct complex znum) 返回復數(shù)znum的絕對值
double fabs(double x) 返回雙精度參數(shù)x的絕對值
long labs(long n) 返回長整型參數(shù)n的絕對值
double exp(double x) 返回指數(shù)函數(shù)ex的值
double frexp(double value,int *eptr) 返回value=x*2n中x的值,n存貯在eptr中
double ldexp(double value,int exp); 返回value*2exp的值
double log(double x) 返回logex的值
double log10(double x) 返回log10x的值
double pow(double x,double y) 返回xy的值
double pow10(int p) 返回10p的值
double sqrt(double x) 返回+√x的值
double acos(double x) 返回x的反余弦cos-1(x)值,x為弧度
double asin(double x) 返回x的反正弦sin-1(x)值,x為弧度
double atan(double x) 返回x的反正切tan-1(x)值,x為弧度
double atan2(double y,double x) 返回y/x的反正切tan-1(x)值,y的x為弧度
double cos(double x) 返回x的余弦cos(x)值,x為弧度
double sin(double x) 返回x的正弦sin(x)值,x為弧度
double tan(double x) 返回x的正切tan(x)值,x為弧度
double cosh(double x) 返回x的雙曲余弦cosh(x)值,x為弧度
double sinh(double x) 返回x的雙曲正弦sinh(x)值,x為弧度
double tanh(double x) 返回x的雙曲正切tanh(x)值,x為弧度
double hypot(double x,double y) 返回直角三角形斜邊的長度(z),x和y為直角邊的長度,z2=x2+y2
2、復雜的數(shù)學函數(shù)可以用自定義函數(shù)的形式實現(xiàn)。
例如:
double ConerVelocity(int A, double x1, double y1, double x2, double y2, double t1, double t2)
{
double T,V;
T=acos(abs(x1 * x2 + y1 * y2)/ sqrt(x1 * x1 +y1 * y1)/sqrt(x2 * x2 +y2 * y2));
V= (A * (t2-t1))/(2*sin(T/2));
return V;
}
關于C語言簡單翻譯,麻煩各位大神幫忙把下面的函數(shù)每句的中文意思寫在后面,謝謝謝
(1)void add_data()
{
structstudent st;//創(chuàng)建結(jié)構體變量st
int b;
int k,i;
while(1)
{
printf("\n請輸入學生信息:");
printf("\n編號\t姓名\t郵政編碼\t電話號碼");
printf("\n---------------------------------------------------------------\n");
scanf("%s%s%s%s",st.no,st.name,st.postcode,st.phonenumber);//將名字,電話號等組包放在st.no下
for(i=0;idd.count;i++)//for循環(huán)每個學號的學生
if(strcmp(dd.stu[i].no,st.no)==0) //如果學生學號和no的相同證明找到了
break;//中斷
if(idd.count)//如果查找的學生數(shù)不在總數(shù)中
printf("您輸入的學號已存在,請重新輸入");
else//這個else是將學號姓名電話等存入stu數(shù)組中,并且計數(shù)
{
k =dd.count;
strcpy(dd.stu[k].no,st.no);
strcpy(dd.stu[k].name,st.name);
strcpy(dd.stu[k].postcode,st.postcode);
strcpy(dd.stu[k].phonenumber,st.phonenumber);
dd.count++;
}
printf("\n\n繼續(xù)添加學生信息[1-yes 0-no]:");
scanf("%d",b);
if(b==0) break;
}
save_data();
}
//此段程序為輸入程序,主程序為數(shù)組和while循環(huán)的結(jié)合體,并且實現(xiàn)的無重復編號的輸入,從而實現(xiàn)的信息的準確性。
(2)void delete_data()
{
int i,k;
charno[10];
printf("\n請輸入要刪除學生的編號:");
scanf("%s",no);
k=-1;
for(i=0;idd.count;i++)//循環(huán)整個學生數(shù)
{
if(strcmp(dd.stu[i].no,no)==0)//如果找到該學號了
{
k=i;//將學號給k變量
break;
}
}
if(k==-1)//沒有找到
{
printf("\n\n沒有找到該學生(編號-%s)!",no);
}
else//根本就沒有
{
for(i=k;idd.count-1;i++)//接著k學號之后的學生找
{
strcpy(dd.stu[i].no,dd.stu[i+1].no);
strcpy(dd.stu[i].name,dd.stu[i+1].name);
strcpy(dd.stu[i].postcode,dd.stu[i+1].postcode);
strcpy(dd.stu[i].phonenumber,dd.stu[i+1].phonenumber);
}
dd.count--;
save_data();
printf("\n\n刪除(編號-%s)成功!",no);
}
}
請用C語言編寫一個譯碼函數(shù),把一個英語句子譯成數(shù)字代碼。譯碼規(guī)則是
#include?stdio.h
int?main?()
{
char?c;
while?((c?=?getchar())?!=?'\n')
{
if(c=='?')
printf("*");
else
{
if(c=97c=122)
printf?("%d?",?c-=96);
else
{
if(c=65c=90)
printf?("%d?",?c-=38);
else
printf?("%c",?c);
}
}
}
return?0;
}
文章標題:c語言翻譯函數(shù) c語言在線翻譯
轉(zhuǎn)載來源:http://www.dlmjj.cn/article/doihgop.html