L02 - first differences

L02 - first differences - What You Should Already Know...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
What You Should Already Know Basic C++ datatypes – bool, int, float, double, char Variables and assignments – declarations and assignment statements Control Structures – if, if/else, if/else if, do-while, for loops, switch, etc. Functions – formal vs. actual parameters – parameter transmission (pass by value, pass by reference) – what happens when a function is called (on the stack), e.g. void writeArray (const int values[], const int size, const ostream &out); – functions and top down design C++ review & C++/CLI - Basics
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
What You Should Already Know (cont.) Arrays – statically declared arrays – as a data structure, what is an array – array name as a reference – arrays as arguments to functions •S t r i n g s – standard C-strings as null-terminated arrays of characters •I /O – streams and the string insertion and string extraction operators
Background image of page 2
Remember: The Visual C++ 2005 Environment • When creating a new project: – click on the Visual Studio 2005 icon – if it is your first time since installation, you will need to follow the dialog that tells the system you will normally be dealing with C++ applications – after that (and on subsequent occasions): • click on Create Project • On the left hand side of the box that comes up, choose a project type of CLR • On the right hand side of the box that comes up, choose CLR Console Application • Be sure to give the project a name C++ review & C++/CLI - Basics
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
C++ review & C++/CLI - Basics
Background image of page 4
C++ review & C++/CLI - Basics
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
C++ review & C++/CLI - Basics
Background image of page 6
What does the wizard give you? // blank.cpp : main project file. #include "stdafx.h" using namespace System; int main(array<System::String ^> ^args) { Console::WriteLine(L"Hello World"); return 0; } More on these in a minute This set of arguments to main tell about command line arguments. Make it void for now C++ review & C++/CLI - Basics
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
What about standard C++ and C++/CLI? Addition: A Program that adds two integers (i) // standard C++ version #include “stdafx.h” #include <iostream> using namespace std; int main () { int n1, // 1 st number n2, // 2 nd number sum; // sum of both // C++/CLI Version #include "stdafx.h" using namespace System; int main() { String ^num1, //1st user input ^num2; //2nd user input int n1, //1st number n2, //2nd number sum; //sum of both
Background image of page 8
Addition: A Program that adds two integers (cont.) // C++/CLI Version Console::Write(L”Enter first integer:”); num1 = Console::ReadLine(); Console::Write(L”Enter second integer:”); num2 = Console::ReadLine(); n1 = Int32::Parse(num1); n2 = Int32::Parse(num2); sum = n1 + n2; Console::WriteLine(L”\nSum is {0}”, sum.ToString() ); return 0;
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/08/2008 for the course EE 361 taught by Professor Conry during the Spring '08 term at Clarkson University .

Page1 / 25

L02 - first differences - What You Should Already Know...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online