HW_2 - CS 31: INTRODUCTION TO COMPUTER SCIENCE I Computer...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 31: INTRODUCTION TO COMPUTER SCIENCE I Computer Science Department University of California, Los Angeles Dr. John A. Rohr February 3, 2010 HOMEWORK 2 Objective : Practice vector and matrix input and display. Background : A vector of dimension m consists of m elements in consecutive order. A square matrix of dimension n consists of n 2 elements arranged as n rows by n columns. A vector can be input given the dimension of the vector and the elements of the vector. A square matrix can be input given the dimension of the vector and the elements of the vector. Assignment : Write two programs to input and display vectors and matrices. 1. Write a C++ program that will prompt for and read a dimension n , read element values and store them in a vector of dimension n , and display the vector vertically. Support vectors of dimension 1 to 10. Display each vector element on a separate line using default width and exactly four decimal places for each value displayed. 2. Write a C++ program that will prompt for and read a dimension m , read element values and store them in a square matrix of dimension m
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/08/2010 for the course COM SCI 31 taught by Professor Kinsey during the Spring '98 term at UCLA.

Page1 / 2

HW_2 - CS 31: INTRODUCTION TO COMPUTER SCIENCE I Computer...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online