CS 1371 Lecture Notes - Lecture 2: C String Handling

66 views5 pages

Document Summary

[r c] = size(popmatrix) ct=0 for i = 1:r for j = 1:c popmatrix(i,j) = i+j ct = ct + 1; end end for 1 = 1:6 for j = 2:2:7 ct = ct+1; end end. %inner loop runs 3 times, outer runs 6 therefore counter (ct) = 18. %% accesses the array for i = 6:7 mygrades. hwk(i) = input( hwk grade /n") end. %%input additional hwk grades mygrades. course = . 15 *mean(mygrades. hwk) + . 45*mean(mygrades. tst) + . 5*mygrades. fe. %calculate avg grade in a class mygrades. name = ( first", last") %example 2 clear; clc jb. last = bieber" jb. first = justin" jb. single = true jb. school = false jb. arrest = 4 date. day = 1 date. month = mar" date. year = 1994 jb. bday = date. 11105 date. xxx is a struct embedded into jb. bday date. day = 15. %adding this now does not change it in jb. bday selena = jb selena. first = selena" selena. last = gomez" selena. bday. day = 22.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers