|
-
Aug 22nd, 2000, 01:54 PM
#1
Here is the code...
Code:
///////////////////////////////////////////////////////////////////
//header statements
#include <iostream.h>
#include <stdlib.h>
///////////////////////////////////////////////////////////////////
//functions
void size();
void charac():
///////////////////////////////////////////////////////////////////
//main
void main()
{
cout<<"Hello, I am Disposable Hero A59."<<endl;
cout<<""<<endl;
size();
charac();
}
///////////////////////////////////////////////////////////////////
//size()
void size()
{
cout<<"The size of a char is\t"<<sizeof(char)<<" bytes"<<endl;
cout<<"The size of a short is\t"<<sizeof(short)<<" bytes"<<endl;
cout<<"The size of an int is\t"<<sizeof(int)<<" bytes"<<endl;
cout<<"The size of a long is\t"<<sizeof(long)<<" bytes"<<endl;
cout<<"The size of a float is\t"<<sizeof(float)<<" bytes"<<endl;
cout<<"The size of a double is\t"<<sizeof(double)<<" bytes"<<endl;
cout<<""<<endl;
cout<<"The size of the variables was found by using the 'sizeof()' function."<<endl;
system("pause");
system("cls");
}
///////////////////////////////////////////////////////////////////
//charac()
void charac()
{
cout<<"These are the characters from 32 to 128"<<endl;
cout<<""<<endl;
for(int i=32; i<128; i++)
{
cout<<(char)i;
}
cout<<""<<endl;
cout<<"These were found by using the '(char)' function."<<endl;
system("pause");
system("cls");
}
And here are the errors
Code:
error C2062: type 'void' unexpected
error C2084: function 'void __cdecl charac(void)' already has a body
I cant figure it out...
Can you?
-
Aug 22nd, 2000, 01:59 PM
#2
Monday Morning Lunatic
Try using 'int main' rather than 'void main', then adding a 'return 0' at the end of the main() function.
Also, what are your line numbers on the errors, please.
One edit later...
After your prototype of charac, you have a ':' not a ';'.
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
-
Aug 22nd, 2000, 02:06 PM
#3
Thanks, it was the ":" thats was making both errors. I couldnt see the difference on my screen though.
-
Aug 22nd, 2000, 02:09 PM
#4
Monday Morning Lunatic
I had to run it through the compiler before I noticed...
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
-
Aug 23rd, 2000, 07:13 AM
#5
Fanatic Member
I noticed it the moment parksie pointed it out.
-
Aug 23rd, 2000, 12:43 PM
#6
Monday Morning Lunatic
Yeah, yeah. Like hell you did
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
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
|