c语言系列(一)基本数据类型

论坛 期权论坛     
匿名小用户   2019-10-20 18:11   106   0
<p style="color:rgb(85,85,85);font-family:'microsoft yahei';font-size:14px;line-height:35px;">
1.声明头文件,相当于<a class="replace_word" data-token="dfa9f7941d2ea19a98e9fec911402bad" href="http://lib.csdn.net/base/javaee" rel="nofollow" style="text-decoration:none;color:rgb(223,52,52);font-weight:bold;" title="Java EE知识库">Java</a>的导包。</p>
<pre class="blockcode" style="font-family:'Source Code Pro', monospace;font-size:14px;line-height:1.45;color:rgb(51,51,51);border:1px solid rgba(128,128,128,.0745098);">&lt;code class="hljs cpp has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"&gt;   &lt;span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"&gt;//只有函数的声明,编译时会去找到函数的实现&lt;/span&gt;
    &lt;span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;"&gt;#include &lt;stdio.h&gt; &lt;/span&gt;&lt;/code&gt;&lt;ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"&gt;&lt;li style="box-sizing: border-box; padding: 0px 5px;"&gt;1&lt;/li&gt;&lt;li style="box-sizing: border-box; padding: 0px 5px;"&gt;2&lt;/li&gt;&lt;/ul&gt;&lt;ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"&gt;&lt;li style="box-sizing: border-box; padding: 0px 5px;"&gt;1&lt;/li&gt;&lt;li style="box-sizing: border-box; padding: 0px 5px;"&gt;2&lt;/li&gt;&lt;/ul&gt;</pre>
<p style="color:rgb(85,85,85);font-family:'microsoft yahei';font-size:14px;line-height:35px;">
2.写main()方法</p>
<pre class="blockcode" style="font-family:'Source Code Pro', monospace;font-size:14px;line-height:1.45;color:rgb(51,51,51);border:1px solid rgba(128,128,128,.0745098);">&lt;code class="hljs scss has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"&gt;    &lt;span class="hljs-function" style="box-sizing: border-box;"&gt;main()&lt;/span&gt;{
         &lt;span class="hljs-function" style="box-sizing: border-box;"&gt;printf(&lt;span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;"&gt;"hello from c\n"&lt;/span&gt;)&lt;/span&gt;;    &lt;span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"&gt;//\n换行   &lt;/span&gt;
    }&lt;/code&gt;&lt;ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"&gt;&lt;li style="box-sizing: border-box; padding: 0px 5px;"&gt;1&lt;/li&gt;&lt;li style="box-sizing: border-box; padding: 0px 5px;"&gt;2&lt;/li&gt;&lt;li style="box-sizing: border-box; padding: 0px 5px;"&gt;3&lt;/li&gt;&lt;/ul&gt;&lt;ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"&gt;&lt;li style="box-sizing: border-box; padding: 0px 5px;"&gt;1&lt;/li&gt;&lt;li style="box-sizing: border-box; padding: 0px 5px;"&gt;2&lt;/li&gt;&lt;li style="box-sizing: border-box; padding: 0px 5px;"&gt;3&lt;/li&gt;&lt;/ul&gt;</pre>
<p style="color:rgb(85,85,85);font-family:'microsoft yahei';font-size:14px;line-height:35px;">
3.为了观察程序执行的结果,需要调用windows系统的一个指令</p>
<pre class="blockcode" style="font-family:'Source Code Pro', monospace;font-size:14px;line-height:1.45;color:rgb(51,51,51);border:1px solid rgba(128,128,128,.0745098);">&lt;code class="hljs scss has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"&gt;    &lt;span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"&gt;//等待输入&lt;/span&gt;
    &lt;span class="hljs-function" style="box-sizing: border-box;"&gt;system(&lt;span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;"&gt;"pause"&lt;/span&gt;)&lt;/span&gt;; 或者&lt;span class="hljs-function" style="box-sizing: border-box;"&gt;getchar()&lt;/span&gt;;&lt;/code&gt;&lt;ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"&gt;&lt;li style="box-sizing: border-box; padding: 0px 5px;"
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:50
帖子:1079
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP