-
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?
-
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 ';'.
-
Thanks, it was the ":" thats was making both errors. I couldnt see the difference on my screen though.
-
I had to run it through the compiler before I noticed...
-
I noticed it the moment parksie pointed it out.
-
Yeah, yeah. Like hell you did ;)