c++ - error: too few arguments to function -


i new c++ , in college course learning it, have started functions , first lab dealing them. keep getting error each case in switch statement , not sure how correct it.

error: few arguments function 'void addfraction(int, int, int, int)'

#include <iostream> #include <cstdlib>  using namespace std;  void clearscreen(); void printmenu(); void getfraction(int&, int&); void addfraction(int, int, int, int); void subfraction(int, int, int, int); void mulfraction(int, int, int, int); void divfraction(int, int, int, int); //void reducfraction(int &, int &);  int main() {     clearscreen();     printmenu();     return 0; }  //function clears screen void clearscreen() {     cout << string(50, '\n'); }  //function prints menu screen void printmenu() {     int menu;      cout << "fraction calculator\n";     cout << "\n";     cout << "1. add fraction\n";     cout << "2. subtract fraction\n";     cout << "3. multiply fraction\n";     cout << "4. divide fraction\n";     cout << "5. quit\n";     cout << ":";     cin >> menu;      //switch statement drive menu     switch (menu)     {         case '1':   addfraction();                     break;         case '2':   subfraction();                     break;         case '3':   mulfraction();                     break;         case '4':   divfraction();                     break;         case '5':   exit(0);                     break;         default:    {                      cout << endl << "invalid choice\n" << endl;                      printmenu();                     }     }  }  void addfraction(int f1n, int f1d, int f2n, int f2d) {     clearscreen();     getfraction(f1n, f1d);     getfraction(f2n, f2d);     int fan, fad;     fan = (f1n * f2d) + (f2n * f1d);     fad = (f1d * f2d);     //reducfraction();     cout << fan << endl << "---" << endl << fad; }  void subfraction(int f1n, int f1d, int f2n, int f2d) {     clearscreen();     getfraction(f1n, f1d);     getfraction(f2n, f2d);     int fan, fad;     fan = (f1n * f2d) - (f2n * f1d);     fad = (f1d * f2d);     //reducfraction();     cout << fan << endl << "---" << endl << fad; }  void mulfraction(int f1n, int f1d, int f2n, int f2d) {     clearscreen();     getfraction(f1n, f1d);     getfraction(f2n, f2d);     int fan, fad;     fan = (f1n * f2n);     fad = (f1d * f2d);     //reducfraction();     cout << fan << endl << "---" << endl << fad; }  void divfraction(int f1n, int f1d, int f2n, int f2d) {     clearscreen();     getfraction(f1n, f1d);     getfraction(f2n, f2d);     int fan, fad;     fan = (f1n * f2d);     fad = (f2n * f1d);     //reducfraction();     cout << fan << endl << "---" << endl << fad; }  void getfraction(int& numerator, int& denominator) {    cout << "please enter numerator: ";    cin >> numerator;     cout << "please enter denominator: ";    cin >> denominator;     while(denominator == 0)    {       cout << "invalid denominator! enter new one: ";       cin >> denominator;    }     clearscreen(); } 

try:

case '1':        addfraction(1, 2, 3, 4);       break; 

as mentioned in comments under code, calling method undeclared variables.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -