Newsgroup: comp.lang.c++
Subject: error in 41st line tell me whats the mistake i did everything right
From: wajihahmed29@...
Date: Sun, 28 Jul 2013 02:43:46 -0700 (PDT)
Error 41: Declaration syntax error in function main()
#include <iostream.h>
#include <conio.h>
float sum(float,float);
float sub(float,float);
float mult(float,float);
float div(float,float);
float mod(float,float);
void main()
{
clrscr();
int a,b;
char calculator;
cout <<"Press (P) for sum, Press (S) for sub,Press (M) for mult,Press (D) for div,Press (N) for mod";
cin >>calculator;
switch(calculator)
{
case 'P':
cout <<"Sum (a,b)";
cin >>a >>b;
case 'S':
cout <<"Sub (a,b)";
cin >>a >>b;
case 'M':
cout <<"Mult (a,b)";
cin >>a >>b;
case 'D':
cout <<"Div (a,b)";
cin >>a >>b;
case 'N':
cout <<"Mod (a,b)";
cin >>a >>b;
}
float sum(float a,float b)
{
return a+b;
}
float sub(float a,float b)
{
return a-b;
}
float mult(float a,float b)
{
return a*b;
}
float div(float a,float b)
{
return a/b;
}
float mod(float a,float b)
{
return a%b;
}
getch();
}
Subject: error in 41st line tell me whats the mistake i did everything right
From: wajihahmed29@...
Date: Sun, 28 Jul 2013 02:43:46 -0700 (PDT)
Error 41: Declaration syntax error in function main()
#include <iostream.h>
#include <conio.h>
float sum(float,float);
float sub(float,float);
float mult(float,float);
float div(float,float);
float mod(float,float);
void main()
{
clrscr();
int a,b;
char calculator;
cout <<"Press (P) for sum, Press (S) for sub,Press (M) for mult,Press (D) for div,Press (N) for mod";
cin >>calculator;
switch(calculator)
{
case 'P':
cout <<"Sum (a,b)";
cin >>a >>b;
case 'S':
cout <<"Sub (a,b)";
cin >>a >>b;
case 'M':
cout <<"Mult (a,b)";
cin >>a >>b;
case 'D':
cout <<"Div (a,b)";
cin >>a >>b;
case 'N':
cout <<"Mod (a,b)";
cin >>a >>b;
}
float sum(float a,float b)
{
return a+b;
}
float sub(float a,float b)
{
return a-b;
}
float mult(float a,float b)
{
return a*b;
}
float div(float a,float b)
{
return a/b;
}
float mod(float a,float b)
{
return a%b;
}
getch();
}
via Usenet Forums - Usenet Search,Free Usenet - comp.lang.c++ http://www.pocketbinaries.com/usenet-forums/showthread.php?52756-error-in-41st-line-tell-me-whats-the-mistake-i-did-everything-right&goto=newpost
View all the progranning help forums at:
http://www.pocketbinaries.com/usenet-forums/forumdisplay.php?128-Coding-forums
No comments:
Post a Comment