皮皮学,免费搜题
登录
搜题
【简答题】
九、程序设计 共1题 (共计30分) 题目:主函数main()中字符串s为测试数据,字符串s由空格和若 干二进制形式的数字字组成,首先删除字符串s中的 多余空格,即字符串开头和结尾不能有空格,数字字符子 串间只能有一个空格,再将字符串s中二进制形式的数字字 转换成十进制整数,存入数组a中。 例如:字符串s为" 1100 1011 0100 101 ", 删除多余空格后字符串s为"1100 1011 0100 101",转换后 存入数组a有4个十进制整数12,11,4,5。 编写程序: 1 、编写 int del(char s[])函数,按上述规则删除字符串s 中的多余空格,函数返回删除空格后字符串s的长度。不 允许使用C库函数。 2 、编写 int convert(char s[],int a[])函数,将字符串s 中二进制形式的数字字,转换成十进制整数,存入 数组a中,函数返回a中整数个数。 --------------------------------------------------------- 注意:请勿改动主函数main()中的任何语句。 -------------------------------------------------------*/ #include #include #include #include #include #define N 50 int del(char s[]) { /**********Program**********/ /********** End **********/ } int convert(char s[],int a[]) { /**********Program**********/ /********** End **********/ } void main() { char s[N]={" 1100 1011 0100 101 "}; int a[N],n,i; FILE *fp; if((fp=fopen("data.txt","w"))==NULL) { printf("File open error\n"); exit(0); } n=del(s); fprintf(fp,"The string after deleting spaces:%s\n",s); printf("The string after deleting spaces:%s\n",s); fprintf(fp,"The length is:%d\n",n); printf("The length is:%d\n",n); n=convert(s,a); fprintf(fp,"Following are integers:"); printf("Following are integers:"); for(i=0;i
拍照语音搜题,微信中搜索"皮皮学"使用
参考答案:
参考解析:
知识点:
.
..
皮皮学刷刷变学霸
举一反三
【多选题】722型可见分光光度计与754型紫外分光光度计技术参数相同的有()。
A.
波长范围
B.
波长准确度:
C.
波长重复性:
D.
吸光度范围:
【简答题】When Abraham Lincoln was young he worked in a 1 . As a clerk he proved 2 and efficient. One day a woman came into the store and bought some articles. They added up to two dollars and six and a quarter...
【简答题】BBC news. Hello, this is Jerry Smit. The woman who was once seen as —1— to the German Chancellor Angela merkel has said she won't sign for the role. Annegret Kramp-Karrenbauer also plans to step down ...
【简答题】Once upon a time there was a great man who married the woman of his dreams. With their love, they created a little girl. She was a bright and cheerful little girl and the great man loved her very much...
【多选题】722型可见分光光度计与754型紫外分光光度计技术参数相同的有( )。
A.
波长范围
B.
波长准确度
C.
波长重复性
D.
吸光度范
【单选题】患者经前乳房胀痛,痛不可触衣:经行不畅,血色暗红,小腹胀痛;胸闷胁胀,精神抑郁,时叹息;苔薄白,脉弦。治疗应首选的方剂是( )
A.
一贯煎
B.
逍遥散
C.
丹栀逍遥散
D.
柴胡疏肝散
E.
四逆散
【判断题】理论用墨量计算公式为:理论墨量=通孔面积×丝网厚度。( )
A.
正确
B.
错误
【单选题】患者经前乳房胀痛,痛不可触衣,经行不畅,血色色暗红,小腹胀痛,胸闷胁胀,精神抑郁,时叹息,苔薄白,脉弦。其治法是
A.
益气调经
B.
养血调经
C.
补肾调经
D.
健脾调经
E.
疏肝理气调经
【单选题】患者经前乳房胀痛,痛不可触衣,经行不畅,血色暗红,小腹胀痛,胸闷胁胀,精神抑郁,时叹息,苔薄白,脉弦。治疗应首选的方剂是
A.
左归丸
B.
逍遥丸
C.
丹梔逍遥丸
D.
血府逐瘀胶囊
E.
乌鸡白凤丸
【简答题】Part I Directions: In this section, you'll hear some short conversations. At the end of each conversation, one question will be asked. Both the conversation and the question will be spoken only once. ...
相关题目: