关键词不能为空

当前您在: 主页 > 英语 >

c语言元素周期表

作者:高考题库网
来源:https://www.bjmy2z.cn/gaokao
2021-03-01 02:14
tags:

-

2021年3月1日发(作者:变量泵)


Question:




Software development process:


1.



Problem statement:


-



In this program, a defined structure type contained five elements which


represent the feature of an element. User need to input the arbitrary


numbers of the element with the information with the instruction


demonstrated in the screen. These five elements will be store in the variable


with the structure type. After input these elements, the elements with its


information will be listed in order


2.



Analysis:


?



Input:


-



An arbitrary integer which represents the number of element, information


about the input elements.


?



Output:


-



The information about each element input by user will be output in order


?



Additional requirement:


-



None (Be careful to input valid data. If an integer is required to be input, a


non-integer was input, then user will be required input again)


3.



Algorithm:


-



Define a structure type namely


element


in which there are five elements,


The five elements are:


Number




atomic number of the input element



Name




name of the input element


Symbol




chemical symbol of the input element


Weight



atomic weight of the element


Shell




the number of electrons in each shell


-



Declare a array namely


atom


of the type of structure element



-



Define a


is_integer


function to check if the input number is an integer



-



Define a


clrscr


function to clean the screen



-



Define a


scan


function to read and store the information about the element


input by user


.



-



Define a


print


function to output the information about the element in order


input by user



-



Define a main function with no arguments and return value. The process of


input and output will be conducted in the body of the main function.



-



To ask user input the number of elements and the information about each


element.



-



Output the information about the element in the screen



Flowchart:


Is_integer


function:


start


I = 0


j = 0



*str==


'-'


I = I+1


Str = str+1


isdigit(*str)


*str


==0


==



0'?


I == 0


Y


N


Return 1


Return 0


End



Scan


function:


Print



please type the atomic


number of element:



Ask user to input an


integer and store it


in variable



s


< p>
X=s


Input a integer and


store it in



s



Y


is_integer(x)=0?


Input a integer and


store it in



s



Y


is_integer(x)=0?


X=s


Ask user to input


an integer and


store it in variable



s



Atoi(s)>118?


Input


the


atomic


number


X=s


Input a integer and


store it in



s



Y


is_integer(x)=0?


Input a integer and


store it in



s



Y


is_integer(x)=0?


X=s


Ask user to input


an integer and


store it in variable



s



Atoi(s)>118?

Input


the


atomic


name


Input


the


chemica


l symbol


Input


the


atomic


weight


Input


number of


electrons in


each array


end



Print


function:


start


print the


atomic


number


print the


name of


element


print the


chemica


l symbol


print the


atomic


number


m=m+1


print the


number of


electrons in


m shell


m<7


End



4.



Implementation: see c codes in file 1.c with comments


5.



Testing:



This program was tested by input a set of data, the output of this program was


verified very successful. For example:



Enter this program:









Input the information about the 1th element:




Input the information about the 2th element:











The output of this program:




When user is asked to input the number of element, a non-integer was input:

-


-


-


-


-


-


-


-



本文更新与2021-03-01 02:14,由作者提供,不代表本网站立场,转载请注明出处:https://www.bjmy2z.cn/gaokao/685205.html

c语言元素周期表的相关文章

  • 爱心与尊严的高中作文题库

    1.关于爱心和尊严的作文八百字 我们不必怀疑富翁的捐助,毕竟普施爱心,善莫大焉,它是一 种美;我们也不必指责苛求受捐者的冷漠的拒绝,因为人总是有尊 严的,这也是一种美。

    小学作文
  • 爱心与尊严高中作文题库

    1.关于爱心和尊严的作文八百字 我们不必怀疑富翁的捐助,毕竟普施爱心,善莫大焉,它是一 种美;我们也不必指责苛求受捐者的冷漠的拒绝,因为人总是有尊 严的,这也是一种美。

    小学作文
  • 爱心与尊重的作文题库

    1.作文关爱与尊重议论文 如果说没有爱就没有教育的话,那么离开了尊重同样也谈不上教育。 因为每一位孩子都渴望得到他人的尊重,尤其是教师的尊重。可是在现实生活中,不时会有

    小学作文
  • 爱心责任100字作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文
  • 爱心责任心的作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文
  • 爱心责任作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文