Why is it that even the simplest of the example programs from what is regarded as the BEST text on learning MFC (Richard Jones book) will even f***ing compile?
//Project: Ex01a_FirstLastReverse
// Illustrates various CString methods.
// Reverses names. From "George Washington"
// to "Washington, George"
#include <iostream.h>
#include <afxwin.h> // for CString
int main()
{
CString n; // for name
CString n1, n2; // first and last names
int nLen, n1Len, n2Len; // name lengths
n = " George Washington ";
cout << "\n" << n;
n.TrimLeft(); // remove preceeding spaces
n.TrimRight(); // remove spaces on right
nLen = n.GetLength(); // length of the name
int posBlnk = n.Find(" "
; // get position of 1st " "
n1 = n.Left(posBlnk); // grab left portion of name
n1Len = n1.GetLength(); // length of first name
n2Len = nLen - n1Len;
n2 = n.Right (n2Len); // get right portion
n2.TrimLeft();
n = n2 +", " + n1;
cout << "\n" << n;
cout <<"\n";
return 0;
}
Compiling...
Main.cpp
c:\Documents and Settings\Brant Williams\My Documents\Visual Studio Projects\Intro to MFC Programming Assignments\Example Prog Code\Ch01_Part_1_UtilityClasses\Ex01a_FirstLastReverse\Main.cpp(6) : fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory
I still can't get a handle on header files, namespaces, etc etc. Please don't just answer this question by telling to "add this.." I want to understand what the heck is going on.
I have had more frustration trying to get simple Win 32 console programs (with MFC support) to compile that in writing much more involved, difficult programs.... HELP
//Project: Ex01a_FirstLastReverse
// Illustrates various CString methods.
// Reverses names. From "George Washington"
// to "Washington, George"
#include <iostream.h>
#include <afxwin.h> // for CString
int main()
{
CString n; // for name
CString n1, n2; // first and last names
int nLen, n1Len, n2Len; // name lengths
n = " George Washington ";
cout << "\n" << n;
n.TrimLeft(); // remove preceeding spaces
n.TrimRight(); // remove spaces on right
nLen = n.GetLength(); // length of the name
int posBlnk = n.Find(" "

n1 = n.Left(posBlnk); // grab left portion of name
n1Len = n1.GetLength(); // length of first name
n2Len = nLen - n1Len;
n2 = n.Right (n2Len); // get right portion
n2.TrimLeft();
n = n2 +", " + n1;
cout << "\n" << n;
cout <<"\n";
return 0;
}
Compiling...
Main.cpp
c:\Documents and Settings\Brant Williams\My Documents\Visual Studio Projects\Intro to MFC Programming Assignments\Example Prog Code\Ch01_Part_1_UtilityClasses\Ex01a_FirstLastReverse\Main.cpp(6) : fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory
I still can't get a handle on header files, namespaces, etc etc. Please don't just answer this question by telling to "add this.." I want to understand what the heck is going on.
I have had more frustration trying to get simple Win 32 console programs (with MFC support) to compile that in writing much more involved, difficult programs.... HELP