#include<iostream.h>
#include<fstream.h>
#include<conio.h>
ofstream Ofil("ROW-COLUMNAR.DAT",ios::app);
class application
{
 private:
   int number;
   char application [20];
 public:
   void accept_data
  {
   cout<<"enter application: ";
   cin>>"application: ";
   Ofil<<"application"<<endl;
  }    
  
 void display_data()
  {
   char appl;
   ifstream Ifill("ROW-COLUMNAR.DAT",ios::app);
   while(Ifill)
   {
    Ifill.getline(appl);
    cout<<appl;
   }
  }
};
class Calculator:application
  int mc(int x, int y) //Multiply two numbers
 {
  cout <<"\n\n"<< x <<" times "<< y <<" equals "; 
  return (x*y);
 }  
 
  int ac(int a, int b) //Add two numbers
 { 
  cout <<"\n\n"<< a <<" plus "<< b <<" equals "; 
  return (a+b);
 }
 
 int sc(int z, int c) //Subtract two numbers
 {
  cout <<"\n\n"<< z <<" minus "<< c <<" equals "; 
  return (z-c);
 }
 
 int calc(char choice)
{ 
 int on,tw,thr;  
 if (choice == '+') //This whole block checks what the user wants to calculate, and refers to the proper routine to calculate it.
 {
 cout<<"You selected "<<choice<<". Please enter two numbers,\nsepperated by spaces,";  
 cout<<"that you want to add."<<endl;//print instructions for the user  
 cin>>on; //Get the value of variable on    
 cin>>tw; //Get the value of variable tw    
 thr=ac(on,tw); //Get the sum of on and tw, and assign that value to thr    
 cout<<thr<<"\n\n\n\aThanks for using my calculator!"; //Print a thank
 }
 
 else if(choice == '-') 
 
 {  
 cout<<"You selected "<<choice<<". Please enter two numbers,\nsepperated by spaces, that you want to subtract."<<endl;    
 cin>>on;  
 cin>>tw;  
 thr=sc(on,tw);  
 cout<<thr<<"\n\n\n\aThanks for using my calculator!";
 }
 
 else if(choice == '*')
 
 {
 cout<<"You selected "<<choice<<", Please enter two number,\nsepperated byt spaces, that you want to multiply."<<endl;
 cin>>on;
 cin>>tw;
 thr=mc(on,tw);
 cout<<thr<<"\n\n\n\aThanks for using my calculator!";
 }
 else 
 {  
 cout<<"\nPlease reenter that value.\n\a";  
 cin>>choice;  
 calc(choice); 
 }
}; 
friend class Spell Checker:application
 {  
  cout<<spell checker<<endl;
  cin>>"please enter u word: "<<endl;
 };
 
int main()
{
  char clrscr();    
  char choice; 
  int "one";
  int "two";
  int "three";
  while (choice != 'e')
{  
 cout<<"\nPlease enter +,-,or *, and then two numbers,\nsepperated by spaces, that you wish to\nadd,subtract or multiply\nType e and press enter to exit.";

 cin>>choice;
 if(choice != 'e')
 {
  calc(choice);
 }
}
return 0;
}

Recommended Answers

All 3 Replies

what's wrong with it?

output many wrong!

Lets start with main() function.

Line 96: you can not put function calls where variable names are expected. clrscr() is a function call to clear the screen but you preceeded it with the variable type declaration char. If your compiler supports clrscr() function and you want to clear the screen then remove the char variable type declaration.

lines 98, 99 and 100. I have no idea what your intent is here. int is integer variable type, such as they are whole numbers. After the int data type you need to put a variable name, not a character string.

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.