I've been learning from the book C++ without Fear (first edition) and lost my cd so I have no way of checking how to do the exercise properly.I am having trouble with exercise 7.3.2. The idea is that it converts string to uppercase and the exercise is about including pointers. Problem is, it adds /n to the front of the inputted text and doesn't uppercase the first letter.
Thanks in advance :DCode:#include "stdafx.h" #include <iostream> #include <string.h> #include <ctype.h> using namespace std; void convert_to_upper (char *p); int main() { char s[100]; cout << "Enter string to convert and press ENTER: "; cin.getline(s, 99); convert_to_upper(s); cout << "The converted string is: /n"; cout << s; cin.getline(s,99); return 0; } void convert_to_upper (char *p) { while (*p++) *p = toupper(*p); }