上机内容:输出c++基本类型的字节
上机目的:掌握C++的基本类型和其占字节数字节
我的程序:
/*
* 程序的版权和版本声明部分:
* Copyright (c) 2011, 烟台大学计算机学院
* All rights reserved.
* 文件名称:lwf3421.cpp
* 作 者:陆文飞
* 完成日期:2012 年 9 月 14 日
* 版 本 号:v1.0
* 对任务及求解方法的描述部分:
* 输入描述:无
* 问题描述:熟悉程序的编辑、运行过程
* 程序输出:“4 4 8 1”
* 问题分析:略
* 算法设计:略
*/
#include <iostream>
using namespace std;
int main()
{
int a;
float c;
double d;
char e;
bool f;
cout << sizeof(int) << '\t' << sizeof(float) << '\t' << sizeof(double) << '\t' << sizeof(bool) << '\t' <<endl;
return 0;
}
运行结果:
心得体会:第一次写这样正式博文,费了好大劲。这个小程序很简单,学了一年C++多少学了点皮毛。今年我想学好它,我想努力,把过去浪费的时间补会来,我知道还有很长的了路要走,那就从简单的开始吧。
知识点总结:
一个程序可以有多个函数但只能有一个main函数,还有就是C++的基本数据类型及其字节要注意