Aug 22nd, 2000, 01:54 PM
Here is the 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
error C2062: type 'void' unexpected
error C2084: function 'void __cdecl charac(void)' already has a body
I cant figure it out...
Can you?
///////////////////////////////////////////////////////////////////
//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
error C2062: type 'void' unexpected
error C2084: function 'void __cdecl charac(void)' already has a body
I cant figure it out...
Can you?