You need to tell the compiler which namespace to use.
Add this line after your two includes...
using namespace std;
Cheers,
Matt
________________________________
From: dev...@li...
[mailto:dev...@li...] On Behalf Of sam
Ruma
Sent: 14 March 2008 08:04
To: dev...@li...
Subject: [Dev-C++] Visual C++
I'm sorry. i know this really simple, but can someone tell what is wrong
with this code
#include <ctype.h>
#include <fstream>
int main()
{
ifstream infile("input.txt");
ofstream outfile("ouput.txt");
string line;
while (getline(infile,line))
{
for (int i=0; i<line.length(); i++)
if (i==0 || line[i-1] == ' ' && isalpha(line[i]))
line[i] = toupper(line[i]);
outfile << line << endl;
}
}
ERROR:
error C2065: 'ifstream' : undeclared identifier
________________________________
Looking for last minute shopping deals? Find them fast with Yahoo!
Search.
<http://us.rd.yahoo.com/evt=51734/*http:/tools.search.yahoo.com/newsearc
h/category.php?category=shopping>
This email was sent from an email account of BMW (UK) Manufacturing Limited. BMW (UK) Manufacturing Limited is a company registered in England and Wales with company number 3950868; and has its offices at Ellesfield Avenue, Bracknell, Berkshire, RG12 8TA; registered in England and Wales. The contents of this e-mail are confidential and may be privileged and subject to internal monitoring. If you are not the addressee indicated in this message, you may not copy, forward, disclose, deliver or otherwise use it or any part of it in any form whatsoever. You should then kindly notify the sender by replying to this message and destroy it thereafter. Opinions, conclusions and other information in this message that do not relate to the official business of any BMW Group Company shall be understood as neither given nor endorsed by them.
|