my program is:
#include<iostream.h>
#include<conio.h>
#include<process.h>
int main()
{
//clrscr( ) ;
void convert(float &, char &, char);
float distance;
char choice,type='F';
cout<<"\nEnter distance in feet \n";
cin>>distance;
cout<<"\nYou want distance in feets or in inches ?(F/I):\n";
cin>>choice;
switch (choice)
{
case 'F':convert (distance, type, 'F');
break;
case 'I':convert (distance, type, 'I');
break;
default:cout<<"Wrong choice!!!!";
exit (0) ;
}
void convert(float & d, char & t, char ch)
{
switch(ch)
{
case 'F' : if (t=='I')
{
d=d/12;
t='F';
}
break;
case 'I' : if(t=='F')
{
d=d*12;
t='I';
}
break;
}
return (ch);
}
}
can anyone help me out??????
Verified answer
there are exactly 2 problems--
1. you've defined convert inside the main function--function definition within a function is illegal
2. you've returned a value from a void function
hope this works--
#include<iostream.h>
#include<conio.h>
#include<process.h>
int main()
{
//clrscr( ) ;
char convert(float &, char &, char);
float distance;
char choice,type='F';
cout<<"\nEnter distance in feet \n";
cin>>distance;
cout<<"\nYou want distance in feets or in inches ?(F/I):\n";
cin>>choice;
switch (choice)
{
case 'F':convert (distance, type, 'F');
break;
case 'I':convert (distance, type, 'I');
break;
default:cout<<"Wrong choice!!!!";
exit (0) ;
}
}
char convert(float & d, char & t, char ch)
{
switch(ch)
{
case 'F' : if (t=='I')
{
d=d/12;
t='F';
}
break;
case 'I' : if(t=='F')
{
d=d*12;
t='I';
}
break;
}
return (ch);
}
MQ: "we can MAKE PROG track". it truly is in all danger area of motives why Nevermore is my prominent prog metallic band; they by no skill got down to make progressive track, it basically became out that way. Jeff has roots in dying metallic and neo-classical, Warrel comes from a reasonably classical history with previous adventure in skill/thrash, in spite of if all of it comes mutually as progressive. I relish that songwriting attitude so plenty greater desirable than Dream Theater's "shall we placed our track tiers to good use", or Opeth's "enable's make this track as long as obtainable". it truly is to no longer say i do no longer relish the track that those bands placed out, hell I oftentimes point out that prog, dying, and thrash are my holy trinity of metallic. yet nonetheless this isn't any accident that frequently i'm no longer interior the temper to take heed to Dream Theater, yet i'm going to constantly be interior the temper to take heed to Queensryche or Nevermore. i assume what i'm attempting to declare is that I want the greater "humble" prog metallic bands over the theatrical ones. MQ2: someplace in between... I take excitement in a remarkable solo as plenty because of fact the subsequent guy (perhaps somewhat greater), yet often whilst metallic is going into the greater extreme areas of technical playing it loses a great style of melody (i've got heard a great style of avant-garde and -middle bands that had guitarists with spectacular skills, yet interior the tip it basically chanced on as wankery considering the shown fact that they had no self-discipline).
You're missing a closing brace at the end of main, so the compiler thinks you are trying to define a nested function.
Hmm... try a different name than convert() for your function - it may be conflicting with a built-in?
So, rename it convert_dist() or something.