error C2447: missing function header (old-style formal list?)

#include<iostream>
#include<conio.h>



using namespace std;

int main();


{
int array[5],t;

clrscr();

for (int x=0;x<5;x++;)

{
cout <<"How many Numbers do you want to input: "<< x+1 << " : ";
cin >> array[x];

}
for (i=0;i<5;i++)
{
for (int y=0; y<4; y++)

{
if (array[i]<array[y])
{
t=array[i];
array[i]=array[y];
array[y]=t;
}
}
}

cout << endl;

cout << "Your numbers in ascending order:" << endl;


for (x=0;x<5;x++)


cout << " " << array[x];
cout << endl;
cout << endl;

return 0;

}


i need help here please .. it says

error C2447: missing function header (old-style formal list?)
Remove the ';' after main.

Also, clrscr() and conio.h are non-standard, don't use them.
i did that already still it says error.. C2447: missing function header (old-style formal list?) im doing this for hours but still cant figure it out.. =(


when it is done this will be the result..

How many numbers do you want to input: 5

76
87
50
98
101

your number in ascending order:

50
76
87
98
101


i need to set those numbers in ascending order
Last edited on
finally i made it by making another codes...

#include<iostream.h>

void main()

{ int i,j,a,b,x[5],y[5];

cout<<"Enter five numbers:"<<endl;

for(i=0;i<5;i++)

{
cin>>x[i]; }

for(a=0;a<4;a++)

{

for(i=a+1;i<5;i++)

{
if(x[i]<x[a]) { b=x[a]; x[a]=x[i]; x[i]=b; } } }

cout<<"Five numbers in ascending order:"<<endl;

for(i=0;i<5;i++)

{ cout<<x[i]<<endl; }

}
Ouch, void main and iostream.h ...
closed account (49ECpfjN)
I am having trouble with this C++ code. Can anybody help me?
#include <iostream>
#include <string>
#include <iomanip>
//prototypes
char toDigit(char&);
char readDial(char&,char&,char&,char&,char&,char&,char&,char&);
char acknowledgeCall(char d1,char d2,char d3,char d4,char d5,char d6,char d7,char d8);
char d1, d2, d3, d4, d5, d6, d7, d8;
using namespace std;

int main()
{
char readDial(char&,char&,char&,char&,char&,char&,char&,char&);
int returnValue = 0;
while (returnValue != -5)
{
switch(returnValue)
{
case -1: cout << "ERROR - An invalid character was entered" << endl; break;
case -2: cout << "ERROR - Phone number cannont begin with 0" << endl; break;
case -3: cout << "ERROR - Phone number cannont begin with 555" << endl; break;
case -4: cout << "ERROR - Hyphen is not in the correct position" << endl; break;
case -5: cout << "Good-bye" << endl; break;
default: acknowledgeCall(d1, d2, d3, d4, d5, d6, d7, d8);
}
}
return 0;
}
char toDigit(char&);
{
toupper(d);
switch(d)
{
case 'A': case 'B': case 'C':
d = '2'; break;
case 'D': case 'E': case 'F':
d = '3'; break;
case 'G': case 'H': case 'I':
d = '4'; break;
case 'J': case 'K': case 'L':
d = '5'; break;
case 'M': case 'N': case 'O':
d = '6'; break;
case 'P': case 'Q': case 'R': case 'S':
d = '7'; break;
case 'T': case 'U': case 'V':
d = '8'; break;
case 'W': case 'X': case 'Y': case 'Z':
d = '9'; break;
}
}
char readDial(char& d1, char& d2, char& d3, char& d4, char& d5, char& d6, char& d7, char& d8);
{
int retunValue;
cout << "Please enter a phone number or . to quit: " << endl;
cin >> d1 >> d2 >> d3 >> d4 >> d5 >> d6 >> d7 >> d8;
if (d1 == '.')
{
return -5;
}
if (d1 == 0)
{
return - 2;
}

if (d1 == 5 && d2 == 5 && d3 == 5)
{
return -3;
}
if (d4 != '-')
{
return -4;
}
if (result == -1)
return -1;

if (ToDigit(d1,d2,d3,d5,d6,d7,d8) == -1)
return -1;

else
return 0;
phoneNumber = toDigit(char&);
}

char acknowledgeCall(char d1, char d2, char d3, char d4, char d5, char d6, char d7, char d8)
{
cout << "Phone number dialed: " << d1 << d2 << d3 << d4 << d5 << d6 << d7 << d8 << endl;
return 0;
}
It says error C2447: '{' : missing function header (old-style formal list?) on char toDigit (char &) and char readDial(char& d1, char& d2, char& d3, char& d4, char& d5, char& d6, char& d7, char& d8).
No thread hijacking, make your own.

And use code tags.
 
char readDial(char& d1, char& d2, char& d3, char& d4, char& d5, char& d6, char& d7, char& d8);


In that incredibly long function you shouldn't have a semicolon at the end.
Topic archived. No new replies allowed.