Download presentation
Presentation is loading. Please wait.
Published byGervais Robertson Modified over 9 years ago
1
259201 Computer Programming for Engineers Introduction to Programming in C Language on Visual C++ 2005 Platform 259201 Intro. Comp. Prog. C-Language1
2
Getting Started on on Visual C++ 2005 The platform is Microsoft Visual C++ 2005 Express Edition Go to All Programs Visual C++ 2005 Express Edition Microsoft Visual C++ 2005 Express Edition Make sure the Start Page “Show empty environment” and this is how to do it. 259201 Intro. Comp. Prog. C-Language2
3
3 Open Visual C++ 2005 Start Page
4
Start Page “Show empty environment” Go to Tools—Options—Start Up And select Show empty environment as shown in the Fig. below 259201 Intro. Comp. Prog. C-Language4 Select File—Exit. And reopen the Visual Studio C++ 2005
5
259201 Intro. Comp. Prog. C-Language5 Set your environment
6
Fig. Main window Visual C++ without Start Page 259201 Intro. Comp. Prog. C-Language6
7
Write your first (second,…) program 259201 Intro. Comp. Prog. C-Language7
8
First Program on Visual C++ Express 1. Select File New Project. A window will pop up as shown in the Fig. 259201 Intro. Comp. Prog. C-Language8 Fig. New Project
9
2. Go to Project types -> General. 3. Select Empty Project. Type entaneer_cmu for the Project Name 4. Do not change the Location: and Solution Name at this point 259201 Intro. Comp. Prog. C-Language9 Fig. New Project 1 2 3 4 5
10
Fig. New Project window 259201 Intro. Comp. Prog. C-Language10
11
3. Go to Project Tab and Select Add New Item 4. Under Code: Create a new file called test.c 259201 Intro. Comp. Prog. C-Language11
12
Fig. Editor window for entering your code 259201 Intro. Comp. Prog. C-Language12
13
5. Enter the following codes in the editor window #include void main() { printf("259201 - Computer Programming for Engineers!\n"); } 259201 Intro. Comp. Prog. C-Language13
14
Fig. Editor window showing your first program 259201 Intro. Comp. Prog. C-Language14
15
6. Save the file (under the name test.C) 7. Under Build, select Build Solution (Or press F7) to create an output file 8. If successful, the following message will appear in the output box 259201 Intro. Comp. Prog. C-Language15 ======== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
16
Fig. Result on Building the solution in the output Tab 259201 Intro. Comp. Prog. C-Language16
17
Possible Errors : Example 1 You can make possible syntax errors in C programming. For example, type in stead of in the first line. Now Save and Build the solution (F7). A syntax error message should appear in the output dialog box. 259201 Intro. Comp. Prog. C-Language17 #include void main() { printf(“259201 - Computer Programming for Engineers!\n”); }
18
Fig. Syntax error in output tab for example 1. 259201 Intro. Comp. Prog. C-Language18
19
More information on the errors 259201 Intro. Comp. Prog. C-Language19.\test.c(1) : fatal error C1083: Cannot open include file: 'studio.h': No such file or directory.\test.c(1) means the file “test.c”, and (1) means the error is found in Line-1 “Cannot open include file: 'studio.h': No such file or directory” means the library studio.h cannot be found. The correct library is stdio.h, which is needed for C-programming
20
Now Change printf to print without the “f” And re-build the solution 259201 Intro. Comp. Prog. C-Language20 #include void main() { print(“259201 - Computer Programming for Engineers!\n”); } Possible Errors : Example 2
21
Fig. Syntax error in output tab for example 2. 259201 Intro. Comp. Prog. C-Language21
22
Now correct your code, and build the solution 259201 Intro. Comp. Prog. C-Language22 Run your first program ======== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
23
8. Go to Debug, and run the program by selecting Start Without Debugging (or Ctrl-F5). The run results appear as shown in the Fig. below. 259201 Intro. Comp. Prog. C-Language23 รูปที่ 13 command window showing the results
24
259201 Intro. Comp. Prog. C-Language24 Run Result Press any key, and the command window box will disappear
25
10. After finishing with the project, you can leave the Visual C++ program. 11. To re-open the program. Go to File -> Open and select Project/Solution… and select Project1.sln, 259201 Intro. Comp. Prog. C-Language25
26
Open your solution 259201 Intro. Comp. Prog. C-Language26
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.