ASCII - ++ i; cout << setw(3)...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> #include <iomanip> using namespace std; int length(char s[]) { int i = 0 ; while (s[i] != 0) { ++ i ; } return i ; } int main() { char s[] = "Hi Mom!" ; int i = -1 ; do {
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ++ i; cout &lt;&lt; setw(3) &lt;&lt; i &lt;&lt; &quot;: &quot; &lt;&lt; s[i] &lt;&lt; &quot; &quot; &lt;&lt; static_cast&lt;int&gt;(s[i]) &lt;&lt; endl ; } while (s[i] != 0) ; cout &lt;&lt; &quot;The length of s is &quot; &lt;&lt; length(s) &lt;&lt; endl ; }...
View Full Document

This note was uploaded on 10/28/2010 for the course CSCI 1113 taught by Professor Staff during the Spring '08 term at Minnesota.

Ask a homework question - tutors are online