c++ - converting Roman numerals into decimal -


hey guys think i'm close i'm not sure how continue. of questions related problem don't answer anything. error i'm getting right an

(33): error c2064: term not evaluate function taking 1 arguments (41): error c2064: term not evaluate function taking 1 arguments 

header file:

using namespace std;  class romantype { public:      void printroman(char romannum);     int printdecimal(int& total);     int convertroman(int& total);     void setroman(char& roman);      romantype();     romantype(char);  private:     char romannum[6];     int decimal;     int total; }; 

implementation:

#include "stdafx.h" #include <iostream> #include <iomanip> #include "romantype.h"   using namespace std;  romantype::romantype(char) {  }; void romantype::printroman(char romannum) {     cout << "here number in roman numeral form: " << romannum << endl; };  int romantype::printdecimal(int& total) {     cout << "here number in decimal form: " << total << endl;     return total; };  void romantype::setroman(char& romannum) {  }; int romantype::convertroman(int& total) {     int len = 0;     len = strlen(romannum);     int count[1];       for(int = 0; < len; i++)      {                       switch(romannum[i])            {                  case 'm':                       count[i] = 1000;                       break;                  case 'm':                       count[i] = 1000;                       break;                  case 'd':                       count[i] = 500;                       break;                  case 'd':                       count[i] = 500;                       break;                  case 'c':                       count[i] = 100;                       break;                  case 'c':                       count[i] = 100;                       break;                  case 'l':                       count[i] = 50;                       break;                  case 'l':                       count[i] = 50;                       break;                  case 'x':                       count[i] = 10;                       break;                  case 'x':                       count[i] = 10;                       break;                  case 'v':                       count[i] = 5;                       break;                  case 'v':                       count[i] = 5;                       break;                  case 'i':                       count[i] = 1;                       break;                  case 'i':                       count[i] = 1;                       break;                  default:                       cout << "error.." << endl;            }               total = total + count[0];      }      return total; }; 

my main:

#include "stdafx.h" #include <iostream> #include <iomanip> #include "romantype.h"  using namespace std;  int main() {     romantype r;      char romannum;     char choice;     int decimal;     int total;      cout << "hello! please enter roman numeral: " << endl;      cin >> romannum;      cout << endl;       r.setroman(romannum);     r.convertroman(total);      cout << "do want roman numeral or decimal?" << endl;     cout << "press [d] decimal!" << endl << "press [r] roman numeral!" << endl;      cin >> choice;      if (choice == 'd' || choice == 'd')          r.printdecimal(total);     else if (choice == 'r' || choice == 'r')          r.printroman(romannum);     else         cout << "that wasn't right button!" << endl;      system ("pause");     return 0; } 

i'm pretty sure i'm on right track. nice see tips or advice relating errors.

thanks in advance

from quick @ code, might suggest looking through debug window @ values of variables @ each step. seeing 2 variables, 1 char type named romannum, , entirely different 1 char array named romannum. gets little confusing work if asking user single char in roman numerals wouldn't need array @ all. otherwise, string convert array.

start there , see if helps.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -