Search This Blog

Wednesday, April 3, 2013

The 'Saying' of a Computer Engineer

  Being able  to talk the language of being a computer engineer is an important task. One main reason is because coding is in a sense a different language. There are some terms that must be known, such as memory, variables, for, if, when, while (these basic words are commands that have different meanings in computers) and a flow of logic to understand it.
  Currently, I'm taking an intro to a programming class right now, and working on some problems. One of them is making a basic food donation-request table, a pretty basic array of integers and strings. Here's what part of it looks like:


/* Daniel Josol
   COP 3223
   Assignment 3a */
   
#include <stdio.h>
//100 objects needed
int donatelist[101];
int requestlist[101];
char dfoodlist[101][30];
char rfoodlist[101][30];
int donindex=0; //Best to assign an index number to both lists in order to keep track of them
int reqindex=0;
int main()
{
    int a=0;
    for (a=0; a<100; a++)
    {
      donatelist[a]=0;
      requestlist[a]=0;
    }
    int choice = 0;
    while (choice != 5)
    {
    printf("\nSize of donate list: %d\n", donindex);
    printf("Size of request list: %d\n", reqindex);
    printf("Menu interface: \n1. Donate\n2. Request\n3. Fulfill Oldest Request\n4. Print Status Report\n5. Exit\nEnter Option: ");
    scanf("%d", &choice); //All these functions below are void functions, void = no value is returned
                if (choice==1)
                   Donate();
                if (choice==2)
                   Request();
                if (choice==3)
                   Fulfill();
                if (choice==4)
                   Printer();
    }
    
    
    system("pause");
    return 0;
}
This is how the main class looks like, the functions are included in the original file. It opens up the basic command prompt, pulling up a menu like this:

It's a very basic language, C, there are many other more practical languages to learn in the future, but those that are trying to get started, C and Java are good places to start. It is an important skill in order to 'speak' the language of programming. There are strict rules on syntax and how it must be typed. One wrong key could ruin the whole program.

No comments:

Post a Comment