CS 2073 Engineering Programming Running C Programs, Fall 2005
Available Systems to run C:
NEW AS OF 17 Nov 2005:
Visual C++ 2005 Express Edition:This is the only C++ that is now available in the
CS lab, Science Building 1.02.04. (Visual C++ 6.0 is
no longer there. The new .NET C++ is on the machines,
but we have not been able to get it to work without
"administrative or debugger privileges".)
Microsoft Visual C++ 6.0:
This software should still be available various places
in the Business building and elsewhere.
C/C++ compiler from bloodshed.net:
This is a much smaller system, free to download and easier to use
than Visual Studio, but similar to it.
Mr. Cody Ezi in our class particularly recommended this compiler,
with a download at:
http://www.bloodshed.net/devcpp.html.
C/C++ under Unix or Linux: This is what CS students
might be more likely to use. Fairly hard to learn to use.
Any other C/C++ you have access to:
NEW AS OF 17 Nov 2005:
Using Visual C++ 2005 Express Edition.
THIS IS ONLY IN THE CS LAB: SB 1.02.04.This may be a litte annoying to use,
but it's not much different
from what you have been using -- just a few extra steps.
From the "Start" button, go to "All Programs", to
"Visual C++ 2005 Express Edition" and then to
"Visual C++ 2005 Express Edition" (same name again).
Click on this program to start it up.
Pull down the "File" item at the upper left, and go to
"New" and on to "Project".
In the "New Project" box provided,
click on the "Win32" on the left.
("Win32 Console Application" should already be clicked on the right.)
Under "Name:" give it a new name, say,
"anyname3" (which is what I used).
Be sure to UNcheck the box
"Create dir. for solution".
Finally, click "OK".
The next window that comes up will be
"Win32 Application Wizard - anyname3" (of course yours
will have the name you have chosen for the project).
Click "Next>". Then in the next version of the window with
the same title, click "Console application" and
"Empty project". Finally click "Finish".
Now on the right (oh, shit, or was it left?),
under "anyname3" (your project name),
LEFT click on the box in front of
"Source Files". Go on to "Add"
and on to "New Item".
In the window that appears, on the left click "code"
and on the right click "C++ File (.cpp)".
Give your file a name (I used "anyname.cpp".)
(If you use a name ending in ".c"
instead of ".cpp", the system will insist on strict
C syntax.)
Enter you program in the box, or copy a program in.
I used:
#include <stdio.h>
int main() {
printf("Bill Gates burn in hell!\n");
int x;
scanf("%i", &x);
printf("Entered: %i\n", x);
}
Now under the item "Debug" at the top
middle, pull down to "Start Without Debugging".
Then click "Yes" to build the executable.
The program should execute in the black box, just
like you are used to.
Using Microsoft Visual C++ 6.0:
Fortunately, there are simple steps that allow us to run
a simple C program without using much of the features available.
Here are the steps we've been using in class:
From the "Start" button, go up to
"Microsoft Visual Studio 6.0" and then to
"Microsoft Visual C++ 6.0". Click on this program to start it up.
Pull down the "File" item at the upper left, and click
on "New".
In the box provided, click on the "Files" tab.
In the list provided, click on "C++ Source File".
You can enter a name is the place provided, say in the
first example dist.c, or just use the default name.
Click on "OK" in the box.
Now a white area will appear, where a C program belongs.
Use copy and paste or just enter a C program that you
want to run.
Pull down the "Build" item at the upper middle, and click
on "Compile". (Click "Yes" to the question about a project
file not existing.)
Pull down the "Build" item at the upper middle, and click
on "Execute". (Click "Yes" to the question about an executable
file not existing.)
At this point, a black window will appear that holds the output
of your program. If you have to enter any data for the program,
it will appear in this box.
Making up a file for program submission:
Open an empty Notepad window ("Start" --> "Accessories" --> "Notepad").
Copy the original program from Visual Studio (using mouse
selection and ctrl-c),
and paste it it into the Notepad window (using ctrl-v).
We want to copy the output in the black window into the Notepad
window at the end. In order to do this, move the mouse into the
black window. Right click in that window and release.
Then click on "select all".
Then hit the "Enter" to copy this material.
Finaly use ctrl-v to copy this into the Notepad document.
You can get access to the file inside the Notepad
by emailing it to yourself. One easy way is to use your UTSA
Lonestar account to email it to yourself (or elsewhere):
https://lonestar.utsa.edu/webmail/
Now go on to the directions for submitting the program and
its output: Submission directions.
Revision date:2005-08-30.
(Please use ISO
8601, the International Standard.)