CS 2073 Engineering Programming
Running C Programs, Fall 2005


Available Systems to run C:


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.

  1. 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.

  2. Pull down the "File" item at the upper left, and go to "New" and on to "Project".

  3. 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".

  4. 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".

  5. 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.)

  6. 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);
      }
      

  7. 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:
  1. 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.
  2. Pull down the "File" item at the upper left, and click on "New".
  3. In the box provided, click on the "Files" tab.
  4. In the list provided, click on "C++ Source File".
  5. You can enter a name is the place provided, say in the first example dist.c, or just use the default name.
  6. Click on "OK" in the box.
  7. Now a white area will appear, where a C program belongs.
  8. Use copy and paste or just enter a C program that you want to run.
  9. Pull down the "Build" item at the upper middle, and click on "Compile". (Click "Yes" to the question about a project file not existing.)
  10. 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").
  1. Copy the original program from Visual Studio (using mouse selection and ctrl-c), and paste it it into the Notepad window (using ctrl-v).
  2. 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.
  3. 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):
  4. 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.)