CS 1160 C/C++ Programming 12 MWF - Spring 2016

January 11th thru 15th - Week #1

  1. Handout: day3.pdf Friday handout from ITT 134 lab class.
    Practice using g++, nano, and weblab.uni.edu in StudioIT 1 ITT 134 lab classroom.
    
    hello.cpp file example
    -----
    #include <iostream>
    using namespace std;
    
    int main()
    {
       String name;
    
       cout << "What is your name? ";
       cin >> name;
    
       cout << "Hello " << name << endl;
    }
    
    --------
    area.cpp example developed in class
    --------
              radius of a circle is the input
    
              area of a circle is the output
    
    [jacobson@weblab ~]$ more area.cpp
    #include <iostream>
    using namespace std;
    
    int main()
    {
       double radius;
       double area;
    
       cout << "Please enter the radius of your circle: ";
       cin >> radius;
    
       area = 3.14159 * radius * radius;
    
       cout << "Area is " << area << endl;
    }
    
    
  2. Monday 1st day Handout - C++ examples and problem solving approaches.

  3. PDF version of CS 1160 Syllabus for our class.

  4. Tony Gaddis Starting Out with C++ Textbook will not be available yet at the University Book and Supply. We will be using he 7th edition Brief version. It will be cheapter at the bookstore than from amazon.com and they will only get used versions. You do NOT need to get the latest edition, but it is okay if you did or want to.

    See the email notes about textbook: emailTextbook.txt.

  5. I will scan in notes from class later today, probably this Tuesday late afternoon or early evening after teaching my 2 pm class.

  6. Read pages 7, 8, 9, 10 and 11 of http://www.cplusplus.com/files/tutorial.pdf. It explains the "Hello World" example we started at the end of class #1. Just need to read and study page 7 through page 11.
    // Day #1 example - Monday, January 11th, 2015
    
    #include <iostream>
    using namespace std;
    
    int main()
    {
       cout << "Hello World!" << endl;
       return 0;
    }
    
  7. g++ is the name of the compiler program for C/C++ that we will use on the weblab.uni.edu computer system. Using the department's laptop computers on Wednesday in class #2, you will see how to edit and type in a C++ program using nano editor and then compile it using the g++ command and finally how to execute (run) the program.
    [jacobson@weblab ~]$ more day1.cpp     Program was created and stored in a file 
                                               named day1.cpp
    
    // Day #1 example                      nano day1.cpp    was the command
    #include <iostream>                                  used to edit
    using namespace std;                                          the program
                                           more day1.cpp
    int main()                                              is used to display
    {                                                          the file day1.cpp
       cout << "Hello World!" << endl;                            on the screen
       return 0;
    }
    
    
    [jacobson@weblab ~]$ 
    [jacobson@weblab ~]$ g++ day1.cpp      g++ is the name of the compiler
    [jacobson@weblab ~]$
                                                                  
    [jacobson@weblab ~]$ ./a.out           ./a.out is the name of the executable
    Hello World!                                           program, actually just
    
  8. I P O was discussed. Input Processing Output. Pseudocode. Focus on Input and Output first. What is given, what is needed, what is the input? What is the goal or desired result or output?
    I - What is the input for the problem?  What input is needed?  What is given?
        What information do you need to have in order to produce a solution
        or an answer that will be the exciting output?
    
    O - What is the desired output?  What is the result that is needed?
        What will be the result of running the program?
    
    P - How do you get from I to O? 
    
        What processing steps are needed to transform, manipulate, analyze the
             input to obtain the desired output?
        The focus is on HOW to get from I to O.
    
    After you develop the understanding of I and O and have developed the
    algorithm that develops the P for how to go from Input to Output in
    a series of well described well understood steps, then and only then
    do you start to write the C++ code.
    
    Resist the urge to code.
    
    We will cover this in more depth throughout the class as it is the key
    to programming and problem solving.