Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
CS 240Computer
Programming 1Teacher AssistantHadeel Al-Ateeq
١
PDF created with pdfFactory trial version www.pdffactory.com
Announcement
DON’T forgot to SIGN yourschedule OR you will not
be allowed to attend next lecture.
Hadeel Al-Ateeq
٢
PDF created with pdfFactory trial version www.pdffactory.com
Communication
E-mail:õ[email protected]
Hadeel Al-Ateeq
٣
Office hours:õ Saturday(10-12).õ Sunday(9-10).õMonday (8-9).
PDF created with pdfFactory trial version www.pdffactory.com
Textbook
“HOW TO PROGRAM BY C++ DEITEL AND DEITEL”,
Seventh edition.
٤
PDF created with pdfFactory trial version www.pdffactory.com
Grades
Hadeel Al-Ateeq
٥
Evaluation Type GradeHomework 2%Evaluation 5%
Project 5%Final Lab 20%
Total 32%
PDF created with pdfFactory trial version www.pdffactory.com
Installing C++ VB.NET Express Edition
Hadeel Al-Ateeq٦
PDF created with pdfFactory trial version www.pdffactory.com
Software Required
õMicrosoft Visual C++ 2008 Express Edition
http://www.microsoft.com/visualstudio/en-us/products/2008-editions/express
õ After opening this page you will find this link.
7
PDF created with pdfFactory trial version www.pdffactory.com
Install
õAfter downloading, you will get this:
õDouble click.
10
PDF created with pdfFactory trial version www.pdffactory.com
16
After clicking Exitopen Visual C++Then register theproduct.
Install
PDF created with pdfFactory trial version www.pdffactory.com
Opening Visual C++ 2008 Express Edition
17
PDF created with pdfFactory trial version www.pdffactory.com
õ Sign in with your MSN Hotmail account OR MSN Messenger account
õ Then, Click Sign in.
20
Register
PDF created with pdfFactory trial version www.pdffactory.com
õ Fill out the online registration form. Then click Continue
21
Register
PDF created with pdfFactory trial version www.pdffactory.com
õ You will receive Verification E-Mail from Microsoft.
õ Open your email to verify ownership of your email by clicking the link in the email.
õ A web page will be opened.
õ click Continue.
23
Register
PDF created with pdfFactory trial version www.pdffactory.com
register
Copy the Key
24
PDF created with pdfFactory trial version www.pdffactory.com
DONE!
Now Microsoft Visual C++ 2008 is ready to use.
27
PDF created with pdfFactory trial version www.pdffactory.com
Creating a Program
Hadeel Al-Ateeq٢٨
PDF created with pdfFactory trial version www.pdffactory.com
Create a Project٢٩
PDF created with pdfFactory trial version www.pdffactory.com
Create a ProjectThis is the default
location of the project
٣٠
PDF created with pdfFactory trial version www.pdffactory.com
Create a Project
C:\Users\Eman\Documents\Visual Studio 2008\Projects
This Folder differs depending on your user name in your
computer.
٣١
PDF created with pdfFactory trial version www.pdffactory.com
Create a ProjectNow, the project is created and shown in the Solution Explorer
٣٢
PDF created with pdfFactory trial version www.pdffactory.com
Solution ExplorerSolution Explorer
Solution Name = Project Name
Project Name
٣٣
PDF created with pdfFactory trial version www.pdffactory.com
Solution ExplorerIf you can not see Solution Explorer, you can show it as the following: view è Solution Explorer
٣٤
PDF created with pdfFactory trial version www.pdffactory.com
Create a Project
If you want to save your project in a folder on the desktop. How to do it?
٣٥
Create a folder on the desktop, give it a name:CS240-Yourname-yourIDfor example: CS240-NoraAlAhmad-430123123
PDF created with pdfFactory trial version www.pdffactory.com
Create a Project٣٦
PDF created with pdfFactory trial version www.pdffactory.com
٣٧
This is the folder name that you want to create the project in it
PDF created with pdfFactory trial version www.pdffactory.com
Create a ProjectHere, The Project
location is a Folder on the
desktop.
٣٨
PDF created with pdfFactory trial version www.pdffactory.com
Adding Source File(.cpp file)
٣٩
õYou have to write your program in a file called Source File and its extension is .cpp
õSo, you have to add a Source File to your project to write your program in it.
PDF created with pdfFactory trial version www.pdffactory.com
Adding Source File(.cpp file)
٤٠
PDF created with pdfFactory trial version www.pdffactory.com
Adding Source File(.cpp file)
٤١
PDF created with pdfFactory trial version www.pdffactory.com
Adding Source File(.cpp file)
٤٢
PDF created with pdfFactory trial version www.pdffactory.com
Writing a Program
Hadeel Al-Ateeq٤٣
PDF created with pdfFactory trial version www.pdffactory.com
٤٤
Main parts of any C++ program
PDF created with pdfFactory trial version www.pdffactory.com
Main parts of any C++ program
#include<iostream>using namespace std;int main(){
return 0;}; also is important at end of each statement
٤٥
PDF created with pdfFactory trial version www.pdffactory.com
Main parts of any C++ program
#include<iostream>using namespace std;void main(){
}; also is important at end of each statement
٤٦
PDF created with pdfFactory trial version www.pdffactory.com
õWhat happened when one of the main parts is missing?õLet’s try together!
٤٧
Main parts of any C++ program
PDF created with pdfFactory trial version www.pdffactory.com
cout Command
Used to print a specified message on the output screen.
٤٨
Cout << …………………………… ;
Syntax
Description
PDF created with pdfFactory trial version www.pdffactory.com
cout Commandõ Let’s write this program together.
٤٩
PDF created with pdfFactory trial version www.pdffactory.com
Comments
Hadeel Al-Ateeq
٥٠
Used to describe the code segments briefly.
// your comment
Syntax
Description
PDF created with pdfFactory trial version www.pdffactory.com
Hadeel Al-Ateeq
٥١
Comments
PDF created with pdfFactory trial version www.pdffactory.com
How to Debug a program٥٢
PDF created with pdfFactory trial version www.pdffactory.com
How to Debug a program٥٣
PDF created with pdfFactory trial version www.pdffactory.com
Program output٥٤
PDF created with pdfFactory trial version www.pdffactory.com
Errors٥٥
This means your program has no WARNINGS
This means your program has no ERRORS
PDF created with pdfFactory trial version www.pdffactory.com
Saving your
Program
Hadeel Al-Ateeq٥٦
PDF created with pdfFactory trial version www.pdffactory.com
Save your program٥٧
PDF created with pdfFactory trial version www.pdffactory.com
Exit VC++
٥٨
OR1. 2.
PDF created with pdfFactory trial version www.pdffactory.com
Opening a Project
Hadeel Al-Ateeq٥٩
PDF created with pdfFactory trial version www.pdffactory.com
Open a project٦٠
õTo open a previously created project, there are two ways:
õFile è Recent Projects used if the project is recently created.
õFile è Open è Project/Solution
PDF created with pdfFactory trial version www.pdffactory.com
Open a project٦١
õ File è Recent ProjectsThen, choose the project.
PDF created with pdfFactory trial version www.pdffactory.com
Open a project٦٢
õ File è Open èProject/SolutionThen, Browse for the project file.
PDF created with pdfFactory trial version www.pdffactory.com
Open a project٦٣
PDF created with pdfFactory trial version www.pdffactory.com
Open a project٦٤
PDF created with pdfFactory trial version www.pdffactory.com
Open a project٦٥
PDF created with pdfFactory trial version www.pdffactory.com
Printing Code
Hadeel Al-Ateeq٦٦
PDF created with pdfFactory trial version www.pdffactory.com
Make sure that the is located cursor
HERE
PDF created with pdfFactory trial version www.pdffactory.com
PDF created with pdfFactory trial version www.pdffactory.com
Sending the Source File (.cpp)
Hadeel Al-Ateeq٦٩
PDF created with pdfFactory trial version www.pdffactory.com
This the file that contains your code. This is what you should send to me.
Project Name
PDF created with pdfFactory trial version www.pdffactory.com
Locate the .cpp file The Project folder
= Project Name
This the file that contains your code. This is what you should send to me.
PDF created with pdfFactory trial version www.pdffactory.com