chapter 1 用 vc++ 撰寫程式

Click here to load reader

Upload: chloe-abbott

Post on 01-Jan-2016

64 views

Category:

Documents


0 download

DESCRIPTION

Chapter 1 用 VC++ 撰寫程式. Text book: Ivor Horton. In this Chapter. The components of VC++ What is project? How to build a project? How to create and edit a program? How to compile, link and exectute a C++ program? How to create a basic program of Windows?. DOS vs. Windows. Direct or not - PowerPoint PPT Presentation

TRANSCRIPT

  • Chapter 1 VC++Text book: Ivor Horton

  • In this ChapterThe components of VC++What is project? How to build a project?How to create and edit a program?How to compile, link and exectute a C++ program?How to create a basic program of Windows?

  • DOS vs. WindowsDirect or notEvent-driven or not

  • Figure (Text book page 9)

  • Visual C++6.0(IDEIntegrated Development Environment)EditorDebugLinkExecution

  • Visual C++6.0

  • Visual C++6.0MS-DOSFile/New2.Projects 4.5.3.Win32 Console Application

  • 1.Console Application

  • Console Application

  • 4.1.File/New2.Files

    5.3.C++ Source File

  • File.dsp: .dsw: .opt: , .ncb:

  • #include

    using namespace std;

    int main(){cout

  • Visual C++6.0File/New

  • 2.MFC AppWizard [exe] 4.1.Project3.

  • Chapter 2 C++(Namespace)C++(Variables)(Constants)()(Casting Operand)(Variable Scope)

  • (comments)C++

  • ////* /**/ */

  • C++C++DOSmain()

  • main() main( ){//return //}

  • Ex about function()int main(){input_name();sort_name();output_name();return 0;}void input_name(){return 0;}void sort_name(){return 0;}void output_name(){return 0;}

  • // EX2_01.CPP// A Simple Example of a Program#include

    using namespace std;

    int main(){ int apples, oranges; // Declare two integer variables int fruit; // ...then another one

    apples = 5; oranges = 6; // Set initial values fruit = apples + oranges; // Get the total fruit

    cout

  • Ex2_01#includeHeader filePreprocessor directivesusing namespace std;Standard library

  • C#include#include #include "stdafx.h"

  • usingusing

  • #includeint main(void){std::cout
  • :

  • :A~Za~z_255(31)ex:_this

  • (cont.)C++

  • ExamplePriceDiscountpShapeValue_COUNT

  • Example8_Ball7_Up6_packHASH!Mary-AnnMary Ann

  • republican and RepublicanKeywords (see Appendix A)

  • int i;//ichar j[10]; //jfloat k;// k

  • C++