CSE 100 Lecture 10: More Coding Examples

49 views4 pages

Document Summary

Cse 100 lecture seven notes - more coding examples. #include using namespace std; int main() int a = 5, b = 10, temp; //create a format to keep output clean cout << before swapping. << endl; cout << a = << a << , b = << endl; temp = a; a = b; //create a format to keep output clean cout << \nafter swapping. << endl; cout << a = << a << , b = << endl; return 0; Before swapping. a = 5, b = 10. After swapping. a = 10, b = 5. Program demonstrates the use of cout and ifelse statements. Program demonstrates a dynamic code block that switches values of two variables. << endl; cout << "enter the number again: "; cin >> n; /* while i is less than n, execute the body of code and increase the value of i by one */ cout << i + 1 << ".

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