嘿伙计们,我想我真的很亲密,但我不太确定如何继续。所有与我的问题相关的问题都没有真正回答任何问题。我现在遇到的错误是
(33): error C2064: term does not evaluate to a function taking 1 arguments
(41): error C2064: term does not evaluate to a function taking 1 arguments
头文件:
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;
};
执行:
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include "romanType.h"
using namespace std;
romanType::romanType(char)
{
};
void romanType::printRoman(char romanNum)
{
cout << "Here is your number in Roman Numeral form: " << romanNum << endl;
};
int romanType::printDecimal(int& total)
{
cout << "Here is your 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 i = 0; i < 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;
};
我的主要:
#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 your Roman Numeral: " << endl;
cin >> romanNum;
cout << endl;
r.setRoman(romanNum);
r.convertRoman(total);
cout << "Do you want the Roman Numeral or the Decimal?" << endl;
cout << "Press [D] for Decimal!" << endl << "Press [R] for 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 the right button!" << endl;
system ("pause");
return 0;
}
我很确定我在正确的轨道上。很高兴看到与我的错误有关的任何提示或建议。
提前致谢