- 博客(6)
- 资源 (1)
- 收藏
- 关注
原创 ch4_drill
//Write a program that consists of a while-loop that (each time around// the loop) reads in two ints and then prints them. Exit the program when//a terminating '|' is entered.#include "std_lib_facilities.h"int main(){ int val1, val2; whil
2011-01-16 21:36:00 777 1
原创 4.5.1 Why bother with functions?
TRY THIS Implement square() without using the multiplication operator; that is, do the x*x by repeated addition(start a variable result at 0 and add x to it x times). Then run some version of "the first program" using that square(). #include "std_lib_facil
2011-01-05 22:53:00 289
原创 4.4.2.3 for-statements
<br />TRY THIS <br />Rewrite the character value example from the previous Try this to use a for-loop. Then modify your program to alse write out a table of the integer values for uppercase letters and digits.<br />#include "std_lib_facilities.h"int ma
2011-01-05 22:50:00 241
原创 4.4.2.1 while-statements
TRY THIS The character 'b' is char('a'+1), 'c' is char('a'+2), etc. Use a loop to write out a table of characters with their corresponding integer values: a 97 b 98 .... z 122//Version 1#include "std_lib_f
2011-01-05 22:44:00 262
原创 4.4.1.3 Switch technicalities
<br />TRY THIS <br />Rewrite your currency converter program from the previous Try this to use a switch-statement. Add conversions from yuan and kroner. Which version of the program is easier to write, understand, and modify? Why?<br />#include "std_lib_fa
2011-01-05 22:38:00 287
原创 4.4.1.1 if-statements
TRY THIS Use the example above as a model for a program that converts yen, euros, and pounds into dollars. If you like realism, you can find conversion rates on the web.#include "std_lib_facilities.h"int main(){ const double dol_per_yen = 0.0123;
2011-01-05 22:10:00 323
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人