Hi everyone, I was writing a program and out of the 4 functions, one void function is giving 4 errors that I am not able to understand. The function is : void Conversion(double, double, char).
I am posting my program, including the function that is giving the errors.
I have highlighted the function in red. Any help is appreciated.

#include "stdafx.h"


#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;


int main()
{
    char option, unit;
    double minTemp, maxTemp;
    void Pattern(void);
    double SineWave(void);
    void Convert(double,double,char);
    void Quit(void);

    cout<<"Please select an option  from the following menu."<<endl;

    cout<<" P[Pattern] S[Sinusoidal] C[Conversion] Q[Quit] "<<endl;

    cin>>option;

    switch(option)
    {
    case 'P': case 'p':
        void Pattern();
    break;

    case 'S': case 's':
        double SineWave();
    break;

    case 'C': case 'c':
    void Convert(maxTemp, minTemp, unit);
    break;

    case 'Q': case 'q':
        void Quit();
    break;
    }

    return 0;

}

void Pattern()
{
    char character;
    int numChar;
    
    cout<<"You choosed option P[Pattern]."<<endl;
    cout<<"Please enter a character, to display the Pattern."<<endl;
    cin>> character;
    cout<<"Please enter the number of lines for the character to be displayed."<<endl;
    cin>> numChar;

    for(character=0; character<numChar; character++)
    {
        cout<< character<<endl;
    }
}

double SineWave()

{
    double Voltage = 0.0,time = 1.0, num =0.0;
    const double PI = 3.14159265;
    const double freq = 1.0;
    int i=0;

    num = (2*freq*time);
    Voltage = sin(num);

    for (time= 0; time<1.0; time+= 0.1)
    {
        cout<<"At time"<<time<<"voltage = "<<Voltage<<endl;
    }

    return 0;

}



void Convert(double x,double y,char z)
{
    double Celcius, Fahrenheit, minTemp, maxTemp;
    char tempType,c,f;
    
cout<<"To convert temperature from Fahrenheit to celcius, press c, and to convert celcius to Fahrenheit to, press f."<<endl;
    cin>> tempType;
    cout<<"Please enter the range of temperature to be converted(First the maximum and then the minimumseperated by enter)."<<endl;
    cin>>maxTemp;
    cin>>minTemp;

    do
    {
        if(tempType == 'F'||'f')
        
        Fahrenheit = (9/5)*(Celcius+32);
        cout<<Celcius<<"celcius in Fahrenheit= "<<Fahrenheit<<endl;
        minTemp++;
    
    }
    while(minTemp != maxTemp);

    do
    {

    if(tempType == 'C'||'c')
        Celcius = (5/9)*(Fahrenheit-32);
    cout<<Fahrenheit<<"Fahrenheit is = "<<Celcius<<endl;
    minTemp++;
    }while(minTemp != maxTemp);
}

My errors:
Error 1 error C2182: 'Convert' : illegal use of type 'void' c:\users\robogeek\documents\onenote notebooks\elet 2300 (c++)\prog3_bhasin\prog3_bhasin\prog3_bhasin\prog3_bhasin.cpp 49
Error 2 error C2078: too many initializers c:\users\robogeek\documents\onenote notebooks\elet 2300 (c++)\prog3_bhasin\prog3_bhasin\prog3_bhasin\prog3_bhasin.cpp 49
Error 3 error C2360: initialization of 'Convert' is skipped by 'case' label c:\users\robogeek\documents\onenote notebooks\elet 2300 (c++)\prog3_bhasin\prog3_bhasin\prog3_bhasin\prog3_bhasin.cpp 52
Error 4 error C2360: initialization of 'Convert' is skipped by 'case' label c:\users\robogeek\documents\onenote notebooks\elet 2300 (c++)\prog3_bhasin\prog3_bhasin\prog3_bhasin\prog3_bhasin.cpp 52

case 'C': case 'c':
    void Convert(maxTemp, minTemp, unit);

What is this? You call void function like all others:

case 'C': case 'c':
    Convert(maxTemp, minTemp, unit);

"What is this?"
Sorry, I am a beginner and had some confusions.
Anyways, I have made some changes, but I am getting 2 new errors.

New code

void Convert(double maxTemp,double minTemp ,char unit)
{
	double Celcius, Fahrenheit;
	char tempType,c,f;
	cout<<"To convert temperature from Fahrenheit to celcius, press c, and to convert celcius to Fahrenheit to, press f."<<endl;
	cin>> tempType;
	cout<<"Please enter the range of temperature to be converted(First the maximum and then the minimumseperated by enter)."<<endl;
	cin>>maxTemp;
	cin>>minTemp;

	do
	{
		if(tempType == 'F'||'f')
		
		Fahrenheit = (9/5)*(Celcius+32);
		cout<<Celcius<<"celcius in Fahrenheit= "<<Fahrenheit<<endl;
		minTemp++;
	
	}
	while(minTemp != maxTemp);

	do
	{

	if(tempType == 'C'||'c')
		Celcius = (5/9)*(Fahrenheit-32) ;
	cout<<Fahrenheit<<"Fahrenheit is = "<<Celcius<<endl;
	minTemp++;
	}while(minTemp != maxTemp);
}

My errors:
Error 7 error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup MSVCRTD.lib
Error 8 fatal error LNK1120: 1 unresolved externals C:\Users\Robogeek\Documents\OneNote Notebooks\ELET 2300

Try to remove
#include<stdafx.h>
It's obsolete.

But I'm not sure if it will fix your problems...
As you said, you are a beginner. Maybe try with something more simple?

Nope. That does not work.

By removing that include statement, I get this error:

Error 4 fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source? c:\users\robogeek\documents\onenote notebooks\elet 2300 (c++)\prog3_bhasin\prog3_bhasin\prog3_bhasin\prog3_bhasin.cpp 153

Any other suggestions?

The problem isn't in your code anymore, it's something to do with compiler and OS that you're using.
I'm clueless

Alright, I was able to solve the compiling error. This is what I did:
Pressed ALT+F7
Clicked on Configuration Properties, then on Linker and then clicked system.
After that on the right side under subSystem, changed it to Console(/Subystem console)

The program compiles without errors, but there is some logical mistake in my program.

What I tried doing is if the user inpurts p or P, the case p calls the function which is defined in void Pattern(). But when I ran the program after entering p or any other case letter, it displays "press any key to continue".

Where can I be wrong?

Thanks.

Hm... try this:
after line cin>>option add: cin.ignore(80, '\n'); .
It should work. And I trust you ommited all "void" keywords from calling function?
When you want to call void Pattern(void), you just type Pattern();

No, that does not work. Besides, just wondering, why would input cin.ignore(). I mean I am not trying to ignore anything.
Any other suggestions?

Yes you are trying to ignore.
"cin>>something" is really weird function.
When you write anything in you input, and press enter, then everything is sent into input buffer, but with addition of ENTER sign ('\n').
cin>>option takes one character, but leaves '\n' inside, so when another cin>> tries to read something, it just picks up '\n'.
With cin.ignore() you ignore that '\n'

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.