Click to See Complete Forum and Search --> : cout.put(65) error. why?
wenjiahe
May 5th, 2003, 08:06 PM
VC consloe
cout.put(65)//65 is the ASCII code of 'A'
error C2668: 'put' : ambiguous call to overloaded function
why?
Philip Nicoletti
May 5th, 2003, 08:12 PM
Are you using
#include <iostream.h>
if so, that is non-standard ... use the standard
#include <iostream>
wenjiahe
May 5th, 2003, 08:39 PM
Originally posted by Philip Nicoletti
Are you using
#include <iostream.h>
if so, that is non-standard ... use the standard
#include <iostream>
thanks much! but when i use
#include <iostream>
cout became an undeclared identifier!
error C2065: 'cout' : undeclared identifier
Philip Nicoletti
May 5th, 2003, 08:53 PM
the stream functions reside in namespace std,
so you need something like this:
#include <iostream>
using namespace std; // add this line
int main()
{
cout.put(65);
return 0;
}
or you can qualify cout as follows :
#include <iostream>
int main()
{
std::cout.put(65);
return 0;
}
If you do a search on Andreas Masur posts, he has a
good exaplanation on namespaces
Philip Nicoletti
May 5th, 2003, 08:56 PM
here is a link on namsespace
http://www.codeguru.com/forum/showthread.php?s=&threadid=236873&highlight=namespace
wenjiahe
May 5th, 2003, 09:04 PM
thanks again! you have help me resolve the problem throughly
btw:
West Virginia an beautiful place I have known from
<take me home country roads > of John denver
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.