MFC学习笔记1 建立工程 C数据结构
2017-11-21 16:52
465 查看
本系列学习笔记来源于《VC++就业培训宝典之MFC视频教程》,记录自己系统化学习VC++过程
MFC 还提供了一个应用程序框架,例如应用程序导和类向导自动生成的代码,大大减少了软件开发者的工作量,提高了开发效率。
学习环境: VC++6.0
点组件-全部重建, 编译,执行
设置:
- Number 红色
- String 紫色
简介
MFC(Microsoft Foundation Classes) 微软基础类库。MFC 还提供了一个应用程序框架,例如应用程序导和类向导自动生成的代码,大大减少了软件开发者的工作量,提高了开发效率。
学习环境: VC++6.0
第一个控制台程序
点组件-全部重建, 编译,执行
输入数字计算
// First.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <stdio.h> int main(int argc, char* argv[]) { printf("input numbers !\n"); int a,b; scanf("%d %d", &a, &b); printf("%d + %d= %d \n", a,b,a+b); return 0; }
全局变量与全局函数
#include "stdafx.h" #include <stdio.h> int g_nTet = 32; int g_nT2 = 11; void Test(){ int a,b; scanf("%d %d", &a, &b); printf("%d + %d= %d \n", a,b,a+b); } int main(int argc, char* argv[]) { printf("input numbers !\n"); Test(); return 0; }
结构体
成员变量默认是公有的struct SInfo { int nNumber; char sName[20]; float fSalary; }
类
成员变量默认是私有的#include "stdafx.h"
#include <stdio.h>
int g_nTet = 32;
int g_nT2 = 11;
struct SInfo { int nNumber; char sName[20]; float fSalary; };
class CTest{
public:
int a,b;
char sName[20];
void Display(){
printf("a=%d,b=%d,Name=%s",a,b,sName);
}
};
void Test(){
int a,b;
scanf("%d %d", &a, &b);
printf("%d + %d= %d \n", a,b,a+b);
}
int main(int argc, char* argv[])
{
printf("input numbers !\n");
Test();
return 0;
}
代码格式设置
设置:
- Number 红色
- String 紫色
清除输入缓存与switch分支语句
// First.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <stdio.h> int g_nT2 = 11; void Test() { int a,b; char c; const int t=10; scanf("%d %d",&a,&b); printf("请输入运算符号:[+、-、*、/]"); //输入缓存的清理 fflush(stdin); scanf("%c",&c); int nRet = 0; switch(c) { case '+': nRet = a+b; break; case '-': nRet = a-b; break; case '*': nRet= a*b; break; case '/': nRet = a/b; break; } printf("运行结果:%d%c%d=%d\n",a,c,b,nRet); } int main(int argc,char* argv[]) { g_nT2 = 122; Test(); return 0; }
相关文章推荐
- VS2013MFC对话框工程学习笔记七 - C++数据类型 - 整形 的简单学习
- VS2013MFC对话框工程学习笔记六 - 了解C++的数据类型
- 图像处理 基于Visual C++编程 学习笔记 (1)建立MFC工程,打开bmp文件
- SilverLight学习笔记--实际应用(一)(7):手把手建立一个Silverlight应用程序之数据回滚
- 数据结构——链表学习笔记
- JAVA 数据结构与算法学习笔记一(转载)
- igraph/networkx学习笔记之一 —— 数据结构
- 【MFC学习笔记2】MFC中的数据类型,全局变量,全局函数和宏。
- ARM&LINUX学习笔记(5)-----ADS建立工程
- 我的OpenCV学习笔记(24):详细讨论OpenCV中的数据结构
- C语言学习笔记之数据结构篇(二)
- NSGA 2 学习笔记 -- 数据结构
- OpenCV学习笔记(六十一)——建立支持OpenGL的OpenCV工程“Master OpenCV”chp.3
- [BizTalk][Adapter][部署]BTS学习笔记1:建立一个简单的Biztalk数据交换项目(一)
- Opencv (Opencv2)结合MFC学习数字图像处理【1】---建立工程
- 【学习点滴-数据结构-单链表】单链表的建立,遍历及有序单链表合并
- 数据结构(殷人琨版)学习笔记之单链表
- 数据结构学习笔记一:数据结构基础
- MFC建立一个文档视图的工程,然后在窗口上显示数据
- SilverLight学习笔记--实际应用(一)(5):手把手建立一个Silverlight应用程序之异步数据校验2