| | |
Just started C++. Problems with MS Visual C++ 2005 Express.
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Feb 2007
Posts: 4
Reputation:
Solved Threads: 0
I'm totally new to programming, but have been getting by fine so far.
I'm taking a highschool programming class, and am trying to do some of my assignments from home.
We've been told to work with <iostream.h> for our input and output, but for some reason, I get an error when I try to compile my programs at home;
fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory
The thing is, my code builds without errors when I'm working at school!
I've tried moving the libraries around so that Visual C++ can locate it, but nothing has worked so far.
I really want to start working with <stdio.h> and printf() but I don't think my teacher would accept the work, since he's hellbent on getting us to code with older techniques. (Seems like the lines we're writing aren't very "hip" anymore, since everywhere I look outputs are accomplished with printf() and such.)
Sorry if it was a stupid question. I'll try fiddling some more while I wait for responses.
I'm taking a highschool programming class, and am trying to do some of my assignments from home.
We've been told to work with <iostream.h> for our input and output, but for some reason, I get an error when I try to compile my programs at home;
fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory
The thing is, my code builds without errors when I'm working at school!
I've tried moving the libraries around so that Visual C++ can locate it, but nothing has worked so far.
I really want to start working with <stdio.h> and printf() but I don't think my teacher would accept the work, since he's hellbent on getting us to code with older techniques. (Seems like the lines we're writing aren't very "hip" anymore, since everywhere I look outputs are accomplished with printf() and such.)
Sorry if it was a stupid question. I'll try fiddling some more while I wait for responses.
Last edited by soultron; Feb 25th, 2007 at 1:34 am. Reason: Changed title to be more specific.
<iostream.h> is a deprecated header, and was never part of standard C++. I'm assuming you're using VC++6.0 or a similarly older version of Borland. The standard header is <iostream> so you may have to change it between school and home. You may consider raising the issue with your teacher, but there's a chance that he doesn't care, or may even get mad at you.
printf() is the C way of managing output, and it's much older than C++ output using cout.
•
•
•
•
I really want to start working with <stdio.h> and printf() but I don't think my teacher would accept the work, since he's hellbent on getting us to code with older techniques. (Seems like the lines we're writing aren't very "hip" anymore, since everywhere I look outputs are accomplished with printf() and such.)
> We've been told to work with <iostream.h> for our input and output
Your compiler probably doesn't support it because that header is old and outdated. Try using the Standard Template Library; it's up-to-date and you'll notice the headers don't have a file extension:
> I really want to start working with <stdio.h> and printf()
You're confusing C and C++.
> but I don't think my teacher would accept the work
There is nothing incorrect about using modern coding methods, nor is there any reason why you should revert to outdated libraries. The snippet I showed you above is correct; using iostream.h is not. If he disapproves of it, show him this link.
> since everywhere I look outputs are accomplished with printf() and such.
Actually C++ was invented after C, so printf() and scanf() are actually older than cin and cout. Both languages have their advantages and disadvantages, and although you can mix them, it's generally not a good idea unless you know what you're doing.
Your compiler probably doesn't support it because that header is old and outdated. Try using the Standard Template Library; it's up-to-date and you'll notice the headers don't have a file extension:
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std;
You're confusing C and C++.
stdio.h and printf() are actually C functions. For now, stick with the C++ and the standard template library.> but I don't think my teacher would accept the work
There is nothing incorrect about using modern coding methods, nor is there any reason why you should revert to outdated libraries. The snippet I showed you above is correct; using iostream.h is not. If he disapproves of it, show him this link.
> since everywhere I look outputs are accomplished with printf() and such.
Actually C++ was invented after C, so printf() and scanf() are actually older than cin and cout. Both languages have their advantages and disadvantages, and although you can mix them, it's generally not a good idea unless you know what you're doing.
"Technological progress is like an axe in the hands of a pathological criminal."
All my posts may be freely redistributed under the terms of the MIT license.
All my posts may be freely redistributed under the terms of the MIT license.
•
•
Join Date: Feb 2007
Posts: 4
Reputation:
Solved Threads: 0
Thanks much! I did try using <iostream>, but now I'm getting errors on lines when I use cout, cin and endl; statements. Hah!
EDIT: Thanks joeprogrammer. Your snippet has my program working! I'll be sure to pass on that link to my teacher. Whether or not he'll take to it, I'm not sure. He admitted to not programming in C++ for several years now, and being comfortable with older languages like FORTRAN.
I'm guessing the textbook (published in 1997 ... ) isn't really up to date with the standards of Vis 2005.
Thanks for the help. I'll just have to fiddle with my code in order for it to make the jump from school to home. There's a translation that needs to occur, I just need to find out how to do it. I just hope the work I'm doing now will be useful to my studies in University next year, especially if we're working with a decade-old text!
EDIT: Thanks joeprogrammer. Your snippet has my program working! I'll be sure to pass on that link to my teacher. Whether or not he'll take to it, I'm not sure. He admitted to not programming in C++ for several years now, and being comfortable with older languages like FORTRAN.
I'm guessing the textbook (published in 1997 ... ) isn't really up to date with the standards of Vis 2005.
Thanks for the help. I'll just have to fiddle with my code in order for it to make the jump from school to home. There's a translation that needs to occur, I just need to find out how to do it. I just hope the work I'm doing now will be useful to my studies in University next year, especially if we're working with a decade-old text!
![]() |
Similar Threads
- Visual C++ 2005 Express Edition (C++)
- Visual C++ Express Edition (C++)
- Visual C++ 2005 Express Edition (C++)
- Visual c++ 2005 and OpenGl Problems (Game Development)
- Micosoft Visual C++ streaming problems (C++)
Other Threads in the C++ Forum
- Previous Thread: Pls help :Find first non-repeated char in a string
- Next Thread: help with encryption! asap
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator getline graph homeworkhelp homeworkhelper iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings template text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






