怎么样用while 和 for语句做出如下编程
‘b” is char(“a”+1), “c” is char(“a”+2), use a loop to write out a table of characters with their corresponding integer values:
a 97
b 98
…
z 122
‘b” is char(“a”+1), “c” is char(“a”+2), use a loop to write out a table of characters with their corresponding integer values:
a 97
b 98
…
z 122
解决方案
5
char c = "a"; int nA = 97; for(; c <= "z"; ++c, ++nA) { printf("%c %d\n", c, nA); }
5
for (char i = "a" ; i <= "z" ; i++) std::cout << i << " " << int (i) << std::endl ;
5
a在ascii码表中就是97,可以查一下ascii码相关的知识
5
while(i<“z”-“a”)