Introduction to Computer Programming I

CSI 31
Section 2692

Monday,Wednesday, 12:00pm-1:50pm, room CP 303


Home
Syllabus
Assignments
Notices


  • HW№10 (due date is Wednesday, May 9):
    1. Write a program that will do a search for a value in an array of 12 elements.
    Comments:
    1. The array consists of 12 elements
    2. User inputs the values of elements
    3. User inputs the value to be searched for in the array
    4. Program searches the array and outputs the index of an element which is the one we are looking for. If array doesn't have such number, the program should output: "No such number in the array".

    2. Modify the program 1 so that the size of the array is not known in advance (the user will enter the size of the array)
     
  • HW№9 (due date is Monday, May 7):
    1. Write a program that will do the following:
    - ask a file name (for the input stream)
      - don't forget to check for existance of the file
    - will read-in symbol by symbol from the input stream and immediately output it to the screen
      (it should do it till it reaches the end of the file)

    an algorithm (for this problem):
    ...
    while(not the end of the file)
    {
        read-in one symbol;
        output it to the screen;
    }


    Comments:
    the check for "not the end of the file" should look like this:
      while(!in_stream.eof())
      ...

    2. Write a program that will read all the numbers from an input file and add them up.
     
  • HW№8 (due date is Monday, April 23):
    write a program that will read in 5 numbers from a file
    (you can choose any file name, e.g. ''infile.dat'' or ''in.dat''),
    print them out to screen, then take their product and output into an output file with any name (e.g. ''output.dat'').
     
  • HW№7 (due date is Wednesday, April 18):
    p. 293 №1
     
  • HW№6 (due date is Wednesday, April 11):
    Write functions that find the average of three numbers or of four numbers, and the largest of three or of four numbers.
    Then write a program that should do the following:

    - The program should ask the user to enter the average of how many numbers she/he would like to find (so the user enters either 3 or 4).
    - Then the program should ask to enter those numbers.
    - And after it the program should find the average of those numbers and the largest of those numbers.

    Note: it is a good idea to write a function that finds the largest of two numbers too – because you can use it in the function that finds the largest of three numbers (see example in the lecture slides)

     
  • HW№5 (due date is Monday, April 2):
    p. 244 № 9
    Note: some of the constants from the formulas should be declared as global constants
    (2.9 from Hat size formula and 5.7 from waist formula)

     
  • HW№4 (due date is Monday, March 26):
    p. 175№ 10

     
  • HW№3 (due date is Wednesday, March 7):
    p. 104 № 1
    p. 105 № 6

     
  • HW№2 (due date is Wednesday, February 21):
    pp. 37-38 № 7,8
    I recomend you to do № 6 from p.37 too (but do not submit it)

  • HW№1 (due date is Monday, February 12):

    Write the design and a program that computes the volule of a box.

        The formula for computing the volume of a box is Volume = length * width * height.
    The program should get the values for length, width, and height from the user at the console and output the volume to the screen.

    ! Please, note that a program is a C++ program and design is the following: see design.html