这是中文版《C程序设计语言》中的一段程序

这是中文版《C程序设计语言》中的一段程序
我在visual studio上面运行之后,只能输入字符,但是打印不出nc的值
请问这是为什么?
#include "stdafx.h"

int main()
{
    long nc;
    nc = 0;
    while (getchar() != EOF)
        ++nc;
    printf("%ld\n", nc);
    return 0;
}http://shijue.me/community/photo-details/7ae9f94ee6834db08016b6e2a60a0317_d
http://shijue.me/community/photo-details/b907c1ed7c714f75bb4cbbc7e2ad16de_d
http://shijue.me/community/photo-details/bc5bf3a6f96749a2b67699538528d97b_d
http://shijue.me/community/photo-details/def65304743241dda9d9fdc6f57fd6ad_d
http://shijue.me/community/photo-details/edee9e8b6e444b3cb6b7cbc6814fbc79_d
http://shijue.me/community/photo-details/7fac47f4ceed44889ca3aac4cfcb8540_d
http://shijue.me/community/photo-details/dacb902a563149c3974bbc8d28ab6499_d
http://shijue.me/community/photo-details/4ec78fcf80ea45528eadf3b2521c4bf5_d
http://shijue.me/community/photo-details/46285442fe8748fba055c47203705435_d
http://shijue.me/community/photo-details/f3f66480e3fa469c8ceabd8ee2ebde89_d
http://shijue.me/community/photo-details/af6cb9178b7d4382a009d582d3bd8c38_d
http://shijue.me/community/photo-details/bf9f8221823f4fad9943024c956c3a64_d
http://shijue.me/community/photo-details/3b87f58430ce41949acd17a51ae38381_d
http://shijue.me/community/photo-details/784ec0bcf4444f0ab6de6e702c0a4f00_d
http://shijue.me/community/photo-details/0162ccac99dc4a3ab0ac857ab81c12f3_d
http://shijue.me/community/photo-details/968572cefc0b46f7bef2c45fb85d43a5_d
http://shijue.me/community/photo-details/e85e6634c0f14855a481304ae56421d5_d
http://shijue.me/community/photo-details/3911d2965bd9411cb342082cf7d7658d_d
http://shijue.me/community/photo-details/02863dee54014617a314fa6602f41d50_d
http://shijue.me/community/photo-details/2c546992d5194eb5ae4d2225243771f0_d
http://shijue.me/community/photo-details/3b4467b0acb24acaa11cfcc52a93d1c1_d
http://shijue.me/community/photo-details/c09c962622e64900bb3df15bf8a4c1d6_d
http://shijue.me/community/photo-details/cc5039a56b2040b587521fd3706f6392_d
http://shijue.me/community/photo-details/2ab2069c1a1c4d4b94d37e8f187ccffa_d
http://shijue.me/community/photo-details/bd6166fed8e54bc28ceeb6ddc94149d9_d
http://shijue.me/community/photo-details/c8eba0d38e7f4266a3b407e5b4a0e0ff_d
http://shijue.me/community/photo-details/bdb4f0c4ceb3499f9c43dd78cc9672f5_d
http://shijue.me/community/photo-details/81e062e8fcf64ea9a294087378b1c868_d
http://shijue.me/community/photo-details/262180fe44fd4d978e1357c5d489afb5_d
http://shijue.me/community/photo-details/ecaf7bc612bb43f1b19ff60c7c56ae51_d
http://shijue.me/community/photo-details/4292e4aaf40a4763b01d7a1e2fdb2b36_d
http://shijue.me/community/photo-details/d32e3ba174f64083938dba90080951a0_d
http://shijue.me/community/photo-details/560fdd64023740568ac966f5a84e9b57_d
http://shijue.me/community/photo-details/5974c0a9d11e4f0fa8697a650aa428a2_d
http://shijue.me/community/photo-details/03c211df1d9841bd974020c40ca3528a_d
http://shijue.me/community/photo-details/c7d24596a86e4518bcb04215abf63d8b_d
http://shijue.me/community/photo-details/f67feec7ba3b4d9fae1be5c40c5dbb01_d
http://shijue.me/community/photo-details/a41b86cf150b45a9aa4df4e346413481_d
http://shijue.me/community/photo-details/6c5903678c4f42e390a255b7731ff3b1_d
http://shijue.me/community/photo-details/f892ccc11dec465c8625a55dc03f32cc_d
http://shijue.me/community/photo-details/e9326d915ad54ec989c84e1f7914f825_d
http://shijue.me/community/photo-details/a0318be577c3414e99f1842cad9c8fc3_d
http://shijue.me/community/photo-details/c7eb11350965414eb1e773079d585e03_d
http://shijue.me/community/photo-details/59e25d5856b2467eab33b9b1f01b6114_d
http://shijue.me/community/photo-details/04256f1be37d4d6f8c2a2ea8629a6d64_d
http://shijue.me/community/photo-details/39d0bd4bddf94cf683007c4c2c0eb35e_d
http://shijue.me/community/photo-details/76b903fa1dce420dade9724d959efc71_d
http://shijue.me/community/photo-details/dd545a30755b4d339f24f8b7683b71d0_d
http://shijue.me/community/photo-details/0b2eec6f4ac04505aa85afd769667748_d
http://shijue.me/community/photo-details/fdafeca1ffa447d5865cf1d0e3b627d7_d
http://shijue.me/community/photo-details/5a829b34cf04499f87da3c6f0b800d38_d
http://shijue.me/community/photo-details/1cb5b53c1ae14785baa80c50b6ca2704_d
http://shijue.me/community/photo-details/f7c472aebe7a49d3a8ff20d60502c763_d
http://shijue.me/community/photo-details/5d46db61922344aba6cf35bcd8160c7e_d
http://shijue.me/community/photo-details/af8e57a45db6477da6c58d76e2c5d51b_d
http://shijue.me/community/photo-details/0cc9b81ff5e4436fb9aa27021aca5a9d_d
http://shijue.me/community/photo-details/04cf280bae12474b878132fa953a3fdf_d
http://shijue.me/community/photo-details/189d13540fd142fbb1e284fb13c1180f_d
http://shijue.me/community/photo-details/832c7b92aa8446c691a71e3dad23d180_d
http://shijue.me/community/photo-details/8236d9dc7bda494185e18a0c111d127b_d
http://shijue.me/community/photo-details/1fd464e52f4e4c1b9bf97e1be46e39c2_d
http://shijue.me/community/photo-details/bc2e635ddbba4bea95986332d7d4516d_d
http://shijue.me/community/photo-details/34cea27d26d44f7580e4ade73f0688b2_d
http://shijue.me/community/photo-details/352cf8d0a8fb4b5683059a9bfba00132_d
http://shijue.me/community/photo-details/a99362dc8ea24a4fa580bf341fc5bb54_d
http://shijue.me/community/photo-details/8961172ad94243c69f5c8337f044cf51_d
http://shijue.me/community/photo-details/ff227abee2374a0f9ad7a4c5e49d3f12_d
http://shijue.me/community/photo-details/0b837f0b28df4b269d45367f6a4df3bc_d
http://shijue.me/community/photo-details/06877f0fa4e04be3839dd3cdca4f7751_d
http://shijue.me/community/photo-details/1ca6a77110d24c20b5cbedf2d3d0c5e5_d
http://shijue.me/community/photo-details/a6102c90f39e4aa7b43c77f030ddb4d7_d
http://shijue.me/community/photo-details/a97639443b1145d883c61e34fd7f4252_d
http://shijue.me/community/photo-details/6daf78c79bcb4282b30e04e9e508c62e_d
http://shijue.me/community/photo-details/a33b112a8e854b1e927fe011b21865d3_d
http://shijue.me/community/photo-details/c492c8c1756645ca9cc89fa4803f89f6_d
http://shijue.me/community/photo-details/55d276b240ec4e7b98643b8b5bd41387_d
http://shijue.me/community/photo-details/9bc00da9f5b549b0bac5107046a320a5_d
http://shijue.me/community/photo-details/ecdb6da58d5d49979c9c2cf514b51594_d
http://shijue.me/community/photo-details/a0079097bf924862969dc4b918c1dcec_d
http://shijue.me/community/photo-details/6240a816ee2a4902b319d3dd5fc4914f_d
http://shijue.me/community/photo-details/6fbf4e33e29845b8ade5e5c8f0f1a44a_d
http://shijue.me/community/photo-details/d36ab3365e9449e494d3cffa1c2313c1_d
http://shijue.me/community/photo-details/c1af5ae2d75148a0a8bc95e04e86690d_d
http://shijue.me/community/photo-details/0514516873dd41c197ebd10c8b3c7d2d_d
http://shijue.me/community/photo-details/851304fbdbf84840b65aece3705bf477_d
http://shijue.me/community/photo-details/1d40bac78a4a4f9fa4b57490a09de30b_d
http://shijue.me/community/photo-details/6f274e34f074483484162a2a9a58337e_d
http://shijue.me/community/photo-details/af3b4cfc96ac4f6b939c2d7da62f28c4_d
http://shijue.me/community/photo-details/8caa298ae9e941db9e1087970506db3b_d
http://shijue.me/community/photo-details/c1284bef3d754c1bbd73a49b0e67e559_d
http://shijue.me/community/photo-details/152d7b1909d04df497865223d12d9d9c_d
http://shijue.me/community/photo-details/5d53bebdab3b4dc9a16fd46749b2cab2_d
http://shijue.me/community/photo-details/a6f22beb2b3b4181a728777941fe7e46_d

原文地址:https://www.cnblogs.com/dsfsf/p/8640764.html

时间: 2024-10-22 20:25:23

这是中文版《C程序设计语言》中的一段程序的相关文章

C语言中内存分布及程序运行中(BSS段、数据段、代码段、堆栈)

BSS段:(bss segment)通常是指用来存放程序中未初始化的全局变量的一块内存区域.BSS是英文Block Started by Symbol的简称.BSS段属于静态内存分配. 数据段 :数据段(data segment)通常是指用来存放程序中 已初始化 的 全局变量 的一块内存区域.数据段属于静态内存分配. 代码段: 代码段(code segment/text segment)通常是指用来存放 程序执行代码 的一块内存区域.这部分区域的大小在程序运行前就已经确定,并且内存区域通常属于 

android中获取某段程序的执行时间

Date   startDate   =   new   Date(System.currentTimeMillis()); 在收到设备返回数据之后添加如下语句: Date   endDate   =   new   Date(System.currentTimeMillis()); long diff = endDate.getTime() - startDate.getTime(); 然后在文本框中显示出来: String sDiff = String.valueOf(AmoComActiv

Java基础__慕课网学习(26):程序中判断某段程序执行时间的方法

精确度为毫秒ms:    1 //伪代码 2 3 long startTime=System.currentTimeMillis(); //获取开始时间 4 5 doSomeThing(); //测试的代码段 6 7 long endTime=System.currentTimeMillis(); //获取结束时间 8 9 System.out.println("程序运行时间: "+(end-start)+"ms"); 10 11 //伪代码 12 13 long

为什么会有这么多种程序设计语言?

传说人类建造通天塔触怒上帝,上帝施法使人类语言混乱彼此之间无法交流.这就是说各种各样的语言其实就是祸乱之源——只会导致交流的不便.可是看看如今的程序设计语言的数量,你会怀疑人类是否又在造“通天塔”了?真的有这么多语言的必要吗?我到底要学习多少种程序设计语言才够用呢? 根据维基的资料,可以称得上相对“主流”(有人用.有文档)的程序设计语言至少有600种,还有大量的商业化失败.实用性不高.语言小众(这里的“语言”指的是编码的语言,一般的程序设计语言都习惯用拉丁字母集合或其超集来作为源码的字符集,也有

c#语言中的三种循环

什么是编程 编程就是使用一种程序设计语言编写程序代码,让计算机解决某个问题的过程.根据这个定义来看,根据使用的程序设计语言不同,编写的程序就不同. 关于c#语言: C#是一种最新的.面向对象的编程语言.它使得程序员可以快速地编写各种基于Microsoft .NET平台的应用程序,Microsoft .NET提供了一系列的工具和服务来最大程度地开发利用计算与通讯领域. 正是由于C#面向对象的卓越设计,使它成为构建各类组件的理想之选--无论是高级的商业对象还是系统级的应用程序.使用简单的C#语言结构

在c语言中嵌入汇编语句,对于我来说相当难。

今天早上在csdn论坛上看到一个帖子http://topic.csdn.net/u/20120917/14/82f42e17-977a-4824-95bd-7b79db15d283.html:“C语言中嵌入汇编,究竟有何意义?” 其中看到一个例子是在c语言中插入一段汇编代码获取CPU的主频,制造商和型号的: //=====================================================================================/*      

对于《C程序设计语言》的一点理解

想必学C语言的人大都看过这一经典书籍.对于我来说,处于不同学习层次,阅读这本书的感觉是不一样的,每次阅读都会有一番新的感悟.第一次阅读时先读的英文版,读的很困难,主要是记录不会的单词:第二遍就顺利多了,但是对于其中的内容缺乏较深入的了解:第三遍就直接买了机械工业出版社出版的中文版,尝试读了一遍,但是对于后面几章特别是指针部分几乎读不下去:然后就开始做上面的练习,主要是做了前6章的练习,这其中费了不少时间和精力,还有一部分练习没有做. 对了,需要对这一分类下的博文做出几点说明. ①笔记中所说的[教

清风注解-Swift程序设计语言

前言 Apple发布了全新的Swift程序设计语言,用来开发iOS和OS X平台的应用程序.其目的不言而喻:就是为了给老迈的Objective-C一个合适接班人!因此,不难预见,未来10年必然是Swift语言大放光彩的时代.“长江后浪推前浪,前浪死在沙滩上”-作为一名程序员,紧跟时代潮流是必须具备的职业素养.学习和运用Swift是每一个Apple开发者都必将经历的一个过程. <清风注解>这个系列的诞生目的有三:一是为了鞭策自己,二是为了与大家一起学习Swift,三是分享学习过程中的苦与乐.我会

C语言中的函数、数组与指针

1.函数:当程序很小的时候,我们可以使用一个main函数就能搞定,但当程序变大的时候,就超出了人的大脑承受范围,逻辑不清了,这时候就需要把一个大程序分成许多小的模块来组织,于是就出现了函数概念:  函数是C语言代码的基本组成部分,它是一个小的模块,整个程序由很多个功能独立的模块(函数)组成.这就是程序设计的基本分化方法: (1) 写一个函数的关键: 函数定义:函数的定义是这个函数的实现,函数定义中包含了函数体,函数体中的代码段决定了这个函数的功能: 函数声明:函数声明也称函数原型声明,函数的原型