Lecture10 - Engineering 101 Engineering 101 Lecture 10...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: Engineering 101 Engineering 101 Lecture 10 Lecture 10 Iteration and Iteration and Conditional Statements Conditional Statements Prof. Michael Falk University of Michigan, College of Engineering Announcements Announcements Exam 1 Wednesday 10/4 at 7pm. Room Assignment by First Letter of Last Name A-G IOE 1610 H-O FXB 1109 P-U CSE 1670 V-Z CSE 1690 Announcements Announcements Alternate Administration Monday, Oct. 2 3-5pm in Dow 1017 Alfred Chung Zac Evans-Golden MaryAnn Winsemius Alexandra Holbel Taylor Santiago Jeffery Mortimer Ruixuan Wang Ramsey Hilton Derek Geiger Kyle Polack Randy Tin Dave Retterath Rob Keim Joseph Kirby Edward Wagner Ben Sutton Marcus Lewis Hong Yoon Kim Announcements Announcements You may bring your book, notes, or any other materials you desire. You may bring a calculator. If you have questions about the exam ask the proctor (me or a GSI). You may not communicate with each other or anyone other than the proctor during the exam. Program 4 Program 4 int main( ){ int a, b, c, d, e, f; ofstream outfile(outfile.txt); permute(outfile, 1, 2, 3); outfile.close(); ifstream infile(outfile.txt); infile >> a >> b >> c >> d >> e >> f; infile.close(); cout << f << a << endl; cout << e << b << endl; cout << d << c << endl; return 0; } void permute(ofstream & fout, int a, int b, int c) { fout << a << b << c << endl; fout << a << c << b << endl; fout << b << a << c << endl; fout << b << c << a << endl; fout << c << a << b << endl; fout << c << b << a << endl; return; } Program 4 Program 4 int main( ){ int a, b, c, d, e, f; ofstream outfile(outfile.txt); permute(outfile, 1, 2, 3); outfile.close(); ifstream infile(outfile.txt); infile >> a >> b >> c >> d >> e >> f; infile.close(); cout << f << a << endl; cout << e << b << endl; cout << d << c << endl; return 0; } void permute(ofstream & fout, int a, int b, int c) { fout << a << b << c << endl; fout << a << c << b << endl; fout << b << a << c << endl; fout << b << c << a << endl; fout << c << a << b << endl; fout << c << b << a << endl; return; } 123 132 213 231 312 321 Program 4 Program 4 int main( ){ int a, b, c, d, e, f; ofstream outfile(outfile.txt); permute(outfile, 1, 2, 3); outfile.close(); ifstream infile(outfile.txt); infile >> a >> b >> c >> d >> e >> f; infile.close(); cout << f << a << endl; cout << e << b << endl; cout << d << c << endl; return 0; } 123 132 213 231 312 321 a 123 b 132 c 213 d 231 e 312 f 321 Program 4 Program 4 int main( ){ int a, b, c, d, e, f; ofstream outfile(outfile.txt); permute(outfile, 1, 2, 3); outfile.close(); ifstream infile(outfile.txt); infile >> a >> b >> c >> d >> e >> f; infile.close(); cout << f << a << endl; cout << e << b << endl; cout << d << c << endl; return 0; } 123 132 213 231 312 321 a 123 b 132 c 213 d 231 e 312 f 321 321123 312132 231213 Iteration Iteration So far we have only used...
View Full Document

Page1 / 92

Lecture10 - Engineering 101 Engineering 101 Lecture 10...

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

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