Download presentation
Presentation is loading. Please wait.
Published byAnne Bailey Modified over 9 years ago
1
Course Introduction and Getting Started with C 1 USF - COP-2270 - C for Engineers Summer 2008
2
Why C and Matlab? Why C? Powerful and portable computer language Most well known processors be programmed with C Simple to program Free!! =D Why Matlab? Most powerful programming tool for Engineering Used in many areas From Aerospace Industry To Financial companies No rivals, but expensive =( 2 USF - COP-2270 - C for Engineers Summer 2008
3
Language Classification 3 High Low The Human Language (e.g. English) The High-Level Programming Language (e.g. C) The Machine Language (i.e. binary code) If the line is not busy, connect o the Internet, else, wait… If (line!= busy) connect (Internet); Else wait (5)… 1000100010100010001110 1111111011101011110101 0111010011….. Figure adapted from T. Zhang “Teach yourself C in 24 hours” USF - COP-2270 - C for Engineers Summer 2008
4
Preparing a program for execution 4 Slide modified from original slides for course offered at University of Arizona: http://www.ece.arizona.edu/~ece175/index.html Steps: Editing Create your source code Compilation Linking Create binary code Loading Your program is loaded in memory Execution Then is executed USF - COP-2270 - C for Engineers Summer 2008
5
Getting Started with C Hour 1 5 Presentation original from Dr. Turner’s class USF - COP-2270 - C for Engineers Summer 2008
6
Objectives You will be able to: Create, compile, and run a very simple C program on Windows systems and on Unix systems. 6 USF - COP-2270 - C for Engineers Summer 2008
7
Start Up Visual Studio 2005 On classroom and lab computers look for Microsoft Visual Studio 2005 under Applications. 7 USF - COP-2270 - C for Engineers Summer 2008
8
Start Up Visual Studio 2005 8 Click USF - COP-2270 - C for Engineers Summer 2008
9
Ready to Create a Project 9 Your screens may be slightly different from the screen shots in this presentation. USF - COP-2270 - C for Engineers Summer 2008
10
Creating a C++ Project in Visual Studio 2005 10 Even though it is called a C++ project, we will write a C program. USF - COP-2270 - C for Engineers Summer 2008
11
Creating a C++ Project in Visual Studio 2005 11 USF - COP-2270 - C for Engineers Summer 2008
12
Creating a C++ Project in Visual Studio 2005 12 USF - COP-2270 - C for Engineers Summer 2008
13
Creating a C++ Project in Visual Studio 2005 13 USF - COP-2270 - C for Engineers Summer 2008
14
We Have a Project 14 USF - COP-2270 - C for Engineers Summer 2008
15
Adding a Source File to the Project 15 USF - COP-2270 - C for Engineers Summer 2008
16
Adding a Source File to the Project 16 Click The.c filename extension tells Visual Studio to compile this file as a C program (not C++). USF - COP-2270 - C for Engineers Summer 2008
17
It's Open in the Editor 17 USF - COP-2270 - C for Engineers Summer 2008
18
Add the Program Code 18 USF - COP-2270 - C for Engineers Summer 2008
19
Compile and Link the Program 19 USF - COP-2270 - C for Engineers Summer 2008
20
Run the Program 20 Click here to run USF - COP-2270 - C for Engineers Summer 2008
21
Program "hello.c" in Action 21 Press "Enter" to end program and close window. USF - COP-2270 - C for Engineers Summer 2008
22
Running Without the IDE 22 Open a Windows Explorer window and navigate to the project directory. Your directory structure will be different, but you should have a project directory called “hello” under “Visual Studio 2005\Projects” USF - COP-2270 - C for Engineers Summer 2008
23
Running Without Visual Studio 23 Within the project directory, open the debug folder. Here is the exe file. We can double click here to run the program independently of the IDE. USF - COP-2270 - C for Engineers Summer 2008
24
Running Without Visual Studio 24 USF - COP-2270 - C for Engineers Summer 2008
25
Running Without Visual Studio We can also run the program from the command prompt. Copy the exe file into a convenient directory (e.g. C ) Open a command window cd to the directory Type the command: hello 25 USF - COP-2270 - C for Engineers Summer 2008
26
Running from the Command Line 26 USF - COP-2270 - C for Engineers Summer 2008
27
Let's Move the Program to Unix. 27 Here is our source file. USF - COP-2270 - C for Engineers Summer 2008
28
Open an SSH File Transfer Window 28 Drill down to C:\Documents and Settings\”username”\My Documents\Visual Studio 2005\Projects\hello\hello USF - COP-2270 - C for Engineers Summer 2008
29
Connect to Unix 29 Click here to connect to sunblast USF - COP-2270 - C for Engineers Summer 2008
30
Connecting to sunblast 30 USF - COP-2270 - C for Engineers Summer 2008
31
Connecting to sunblast 31 USF - COP-2270 - C for Engineers Summer 2008
32
Connecting to sunblast 32 USF - COP-2270 - C for Engineers Summer 2008
33
Here we are! 33 Home directory on sunblast USF - COP-2270 - C for Engineers Summer 2008
34
Pick a Directory 34 Pick directory to work in. USF - COP-2270 - C for Engineers Summer 2008
35
Copy Source File 35 Drag source file into remote directory window USF - COP-2270 - C for Engineers Summer 2008
36
Copy Source File 36 The file hello.c has been copied from my Windows system to sunblast. USF - COP-2270 - C for Engineers Summer 2008
37
Open a Terminal Window 37 USF - COP-2270 - C for Engineers Summer 2008
38
Connect to sunblast and cd to test directory. 38 USF - COP-2270 - C for Engineers Summer 2008
39
Compile the Program 39 USF - COP-2270 - C for Engineers Summer 2008
40
Run It 40 USF - COP-2270 - C for Engineers Summer 2008
41
Creating a Source File on sunblast 41 Delete the files that we have been using. (We will start over!) USF - COP-2270 - C for Engineers Summer 2008
42
Creating a Source File on sunblast 42 USF - COP-2270 - C for Engineers Summer 2008
43
Editing in pico 43 USF - COP-2270 - C for Engineers Summer 2008
44
Editing in pico 44 USF - COP-2270 - C for Engineers Summer 2008
45
Write Out the File 45 Type Control-O to write out the file Press Enter to name the output file hello.c USF - COP-2270 - C for Engineers Summer 2008
46
Exit from pico 46 Type Control-x to exit from pico USF - COP-2270 - C for Engineers Summer 2008
47
Back at the Unix Command Line 47 USF - COP-2270 - C for Engineers Summer 2008
48
Compile and Run 48 USF - COP-2270 - C for Engineers Summer 2008
49
Assignment Before next class If you don't have a College of Engineering account, get one. Do the examples from this class for yourself if you didn’t do them in class. Read Hour 1 in text Note that procedures in the book are different from ours. 49 End of Presentation USF - COP-2270 - C for Engineers Summer 2008
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.