MS Visual C++ Introduction. Quick Introduction. A1 Visual C++



Similar documents
Appendix K Introduction to Microsoft Visual C++ 6.0

Creating a Simple Visual C++ Program

Introduction to the use of the environment of Microsoft Visual Studio 2008

How to Compile, Link, and Execute C or C++ Codes Using Microsoft Visual C++

Lab 2 - CMPS 1043, Computer Science I Introduction to File Input/Output (I/O) Projects and Solutions (C++)

Appendix M: Introduction to Microsoft Visual C Express Edition

1. The First Visual C++ Program

Microsoft Visual Studio 2010 Instructions For C Programs

Deitel Dive-Into Series: Dive Into Microsoft Visual C++ 6

William Paterson University Department of Computer Science. Microsoft Visual C++.NET Tutorial Spring 2006 Release 1.0

Visual Studio 2008 Express Editions

Visual C Tutorial

PIC 10A. Lecture 7: Graphics II and intro to the if statement

Embedded SQL. Unit 5.1. Dr Gordon Russell, Napier University

What is a Loop? Pretest Loops in C++ Types of Loop Testing. Count-controlled loops. Loops can be...

DEVELOPING CONTRACT - DRIVEN WEB SERVICES USING JDEVELOPER. The purpose of this tutorial is to develop a java web service using a top-down approach.

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority)

ElectricCommander. Technical Notes MS Visual Studio Add-in Integration version version 3.5 or higher. October 2010

SELF SERVICE RESET PASSWORD MANAGEMENT DATABASE REPLICATION GUIDE

Eclipse installation, configuration and operation

Tutorial on OpenCV for Android Setup

Using Microsoft Visual Studio API Reference

- Hour 1 - Introducing Visual C++ 5

How to Configure a Secure Connection to Microsoft SQL Server

What are we dealing with? Creating a New MS Access Database

Install the Production Treasury Root Certificate (Vista / Win 7)

Assignment 09. Problem statement : Write a Embedded C program to switch-on/switch-off LED.

Common Beginner C++ Programming Mistakes

SELF SERVICE RESET PASSWORD MANAGEMENT BACKUP GUIDE

How to schedule SQL Maintenance Plan

Using Microsoft Expression Web to Upload Your Site

IBM Operational Decision Manager Version 8 Release 5. Getting Started with Business Rules

Generating Visual Studio Project Files

Creating a Java application using Perfect Developer and the Java Develo...

The C++ Language. Loops. ! Recall that a loop is another of the four basic programming language structures

S/MIME on Good for Enterprise MS Online Certificate Status Protocol. Installation and Configuration Notes. Updated: October 08, 2014

Microsoft Excel Tutorial

While You Were Sleeping - Scheduling SAS Jobs to Run Automatically Faron Kincheloe, Baylor University, Waco, TX

How to protect, restore and recover SQL 2005 and SQL 2008 Databases

Symantec Endpoint Encryption Full Disk

Universal Management Service 2015

AutoMerge for MS CRM 3

Workshop for WebLogic introduces new tools in support of Java EE 5.0 standards. The support for Java EE5 includes the following technologies:

Using Visual C++ and Pelles C

Chapter 1: Getting Started

WebSphere Business Monitor V6.2 Business space dashboards

Developing, Deploying, and Debugging Applications on Windows Embedded Standard 7

Migrating to Azure SQL Database

Changing Passwords in Cisco Unity 8.x

User Guide Version 3.0

This tutorial provides detailed instructions to help you download and configure Internet Explorer 6.0 for use with Web Commerce application.

LAB: Enterprise Single Sign-On Services. Last Saved: 7/17/ :48:00 PM

Setting Up ALERE with Client/Server Data

Out n About! for Outlook Electronic In/Out Status Board. Administrators Guide. Version 3.x

Using an Automatic Back Up for Outlook 2003 and Outlook 2007 Personal Folders

CONFIGURING MICROSOFT SQL SERVER REPORTING SERVICES

Lab: Create Your Own Homepage! This exercise uses MS Expression Web as a Web Page creation tool. If you like you

Pocket ESA Network Server Installation

Using Microsoft SQL Server A Brief Help Sheet for CMPT 354

Microsoft Access 2007 Advanced Queries

Secrets of Event Viewer for Active Directory Security Auditing Lepide Software

SELF SERVICE RESET PASSWORD MANAGEMENT CREATING CUSTOM REPORTS GUIDE

F ahrenheit = 9 Celsius + 32

A SharePoint Developer Introduction

Ch 7-1. Object-Oriented Programming and Classes

Copyright Texthelp Limited All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval

Pharmacy Affairs Branch. Website Database Downloads PUBLIC ACCESS GUIDE

StarWind iscsi SAN Software: Implementation of Enhanced Data Protection Using StarWind Continuous Data Protection

Microsoft Access Database

How to configure the DBxtra Report Web Service on IIS (Internet Information Server)

Chapter 8 Selection 8-1

CONVERTING FROM NETKEEPER ISAM v6.32 to NETKEEPER SQL

Chapter 26 EasyPrinter

Veritas Cluster Server Database Agent for Microsoft SQL Configuration Guide

Uninstallation Guide Funding Information System (FIS)

Authoring for System Center 2012 Operations Manager

CS170 Lab 11 Abstract Data Types & Objects

StarWind iscsi SAN Software: Challenge-Handshake Authentication Protocol (CHAP) for Authentication of Users

Sophos Enterprise Console server to server migration guide. Product version: 5.1 Document date: June 2012

EXCEL Tutorial: How to use EXCEL for Graphs and Calculations.

DEPLOYING A VISUAL BASIC.NET APPLICATION

sqlcmd -S.\SQLEXPRESS -Q "select name from sys.databases"

Radica Systems Limited RI Backup/Restore Guide Page: 1

Lab 5 Using Remote Worklight Server

Unity Error Message: Your voic box is almost full

Accessing the Online Meeting Room (Blackboard Collaborate)

SharePoint 2007 Get started User Guide. Team Sites

Computer Programming In QBasic

ScanJour PDF 2014 R8. Configuration Guide

Configuring a Custom Load Evaluator Use the XenApp1 virtual machine, logged on as the XenApp\administrator user for this task.

Microsoft Project Server Integration with SharePoint 2010

Setting Up Database Security with Access 97

Table of Contents SQL Server Option

Eliminate Memory Errors and Improve Program Stability

Vim, Emacs, and JUnit Testing. Audience: Students in CS 331 Written by: Kathleen Lockhart, CS Tutor

Como configurar o IIS Server para ACTi NVR Enterprise

SafeGuard Easy upgrade guide. Product version: 7

All of the IntelliGanttt functions are accessed directly in Microsoft Project from the IntelliGanttt menu on the menu bar.

Beginning with SubclipseSVN

Transcription:

MS Visual C++ Introduction 1 Quick Introduction The following pages provide a quick tutorial on using Microsoft Visual C++ 6.0 to produce a small project. There should be no major differences if you are using version 5.0. The following discussion is based on an actual session using the Visual C++ 6.0 Developer s Studio. The menu selections and options illustrated here do not conform to earlier versions of Visual C++. Please note the disclaimer in the front of these notes regarding compiler selection. During the semester, a version of this appendix will be available via the course Web page for CS 1205: http://ei.cs.vt.edu/~cs1205/ The online version may include additional information and interactive elements that cannot be reproduced here.

Getting Started: MS Visual C++ 6.0 2 To start Microsoft Visual C++ in the McBryde 118 lab, click on, select Programs, Microsoft Visual Studio 6.0, Microsoft Visual C++ 6.0. You should now see a screen that looks similar to this:

Creating a Project 3 Before you can begin coding, you must create a new workspace and project. To do so, go to the File menu and select New. You should see a dialog as shown below. Change the Location of the project to your user directory, (on Drive Z: in the CS lab).

Project Wizard 4 After clicking Ok from the New project dialog window you will be presented with the project creation wizard Win32 Console Application dialog window as shown below: Select an empty project and click Finish.

New Project Information 5 After clicking Finish from the Win32 Console Application dialog window a New Project Information window will simply explain no files were automatically generated. Click Ok to continue. Note the Project Directory. While files can be stored in the C:\tmp directory in the CS lab they will be deleted as soon as you log off and will be lost.

Creating a Project (continued) 6 If in the New Dialog Box: You selected Win32 Console Application (this will create an application that runs at the command prompt [like DOS]). In the Project Name textfield, you named your project Day of the Week. In the Location textfield, you typed the directory in which you wished to store your code files. After clicking OK, you should see a screen that looks similar to this:

Creating a Code File 7 New Source Code File: Now that you have created a Project, you can add source code to it. To do so, go to the Project menu, select Add to Project, then New. You should see the following:

Creating a Code File (continued) 8 Project + Source Code File: Click on C/C++ Source File. In the File Name textfield, type dayofweek. Click OK. You should now see a screen that looks similar to this:

Sample Code Day of Week Program Now in the edit window that just appeared type in the following C++ source code: #include <iostream.h> #include <stdlib.h> int main() //Find the Day of the Week for a Date { int mon, day, year; 9 cout << "Enter a date for which you wish to know" << endl; cout << "the day of the week (MM DD YYYY)? "; cin << month >> day >> year; if (year < 1752) cout << "Only Gregorian dates accepted, sorry " << endl; else { if (month < 3) { //Jan & Feb = 13 & 14 preceding year month += 12; year -= 1; { // end if

Sample Code (continued) Day of Week Program weekday = (day + 2*month + 3*(month+1)/5 + year + year/4 - year/100 + year/400 + 1) % 7; if (month > 12) { //reset Jan & Feb month -= 12; year += 1 ; } // end if 10 cout << month << "/" < day << "/" << year << " falls on "; switch (weekday) { case 0: cout << "Sunday" << endl; break; case 1: cout << "Monday" << endl; break; case 2: cout << "Tuesday" << endl; break; case 3: cout << "Wednesday" << endl; break; case 4: cout << "Thursday" << endl; break; case 5: cout << "Friday" << endl; break; case 6: cout << "Saturday" << endl; break; } // end switch } // end else return EXIT_SUCCESS; } // end main When you are done, save the file (<Ctrl S> or File, Save)

Code Window 11 Code Entry Now that you have entered all of your source code, you should have a window that looks like:

Building an Executable 12 Compilation You can now attempt to build your project. Building involves compiling and linking into an executable. Attempt to build the project, by hitting F7 or from the Build menu, select Build Day of the Week:

Error Messages 13 Finding Errors Notice the compiler error messages in the lower window. Double click on an error message, and the line with the error will be indicated in the code window:

Correcting Errors Compilation Errors Now correct the errors relating to line 8 and build the project again: 14 If you did not format your text similar to the code at the left then the line numbers on the error messages may not match the ones shown.

Error List Error corrections: In case you can't figure out the errors here they are: 15 Line 5: change mon to month add the variable weekday Line 8: change the << to >> (we want to save the value to a variable, not write it to the output stream) Line 15: change the { to } (we want to end the block, not start one) Line 16: change weekday to weekday to match the declaration Line 20: change the < to << Continue correcting errors and rebuilding until you have no errors:

Clean Compilation No Errors 16

Running a Program 17 Program Execution Now that your code has been compiled into an executable, it is ready to be executed. You can do so by pressing <Ctrl F5> or going to the Build menu and selecting Execute Day of the Week.exe Now you should see a DOS prompt with the program running: