|
-
Jun 19th, 2002, 08:57 PM
#1
Code Check
Why won't this work? the compiler says the function is wrong. It's a program that finds ASCII values. pretty straightforward.
Code:
*/
#include <iostream.h>
#include <conio.h>
int main()
{
void calc()
{
int i;
int max;
cin>>max;
for(i=1;i<max;i++)
{
char value=i;
cout<<value<<endl;
}
}
char option;
cout<<"Continue? c=yes"<<endl;
cin>>option;
if(option=='c')
{
calc();
}
getch();
getch();
getch();
return 0;
}
-
Jun 20th, 2002, 11:51 AM
#2
Monday Morning Lunatic
Did it say anything about local function definitions being illegal? 
You have to move it outside of main().
Oh, and it's <iostream>, not <iostream.h> (you'll need a using namespace std; in there after the includes).
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 20th, 2002, 06:26 PM
#3
Monday Morning Lunatic
What compiler? I suggest you change it for one that's actually compliant with the language specification
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 20th, 2002, 06:57 PM
#4
Hyperactive Member
It doesn't need .h??? I have always needed that in my programs... I'm using Microsoft c++. Why is the .h not needed, and what difference will it make in a program?
Now returning to the world of VB. Please make sure your seatbelts are securely fastened and all trays are in their upright and locked position.
-
Jun 20th, 2002, 07:00 PM
#5
Monday Morning Lunatic
In VC++ 5 and above (what I had), you had support for the newer version of the iostreams library, which is in the header without the .h, matching the rest of the standard library; i.e. <vector>, <list>, <string>, <iostream>, etc.
The .h versions of the streams are deprecated (in fact VC++7 gives you a warning about this if you try and use them).
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jul 3rd, 2002, 03:26 AM
#6
The new headers basically have no change in the interface to the user, but are implemented in a better and more generic way. They also provide a few new features and basically work together better.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|