int get_value(void), get_rom(void);
{ /*Turbo C says I have a Declaration Syntax Error on this line.*/
int val, roman;
printf("Enter a Roman Numerical number: ");
roman = toupper(getche());
switch(roman)
{
case 'I':
val = 1;
break;
case 'V':
val = 5;
break;
case 'X':
val = 10;
break;
case 'L':
val = 50;
break;
case 'C':
val = 100;
break;
case 'D':
val = 500;
break;
case 'M':
val = 1000;
break;
default: error_roman();
break;
}
return(value, rom);
}
just copied the .c file for reference but when i tried to run it, it keeps flashing the error and i have no idea what it means ;D help please
btw, how do people post their codes with the line number things? :)
8 2110
Hi,
The line is wrong in syntax.
R u trying to define the function get_value()
If yes then what get_rom means?
I guess u are trying to declare 2 functions get_value, get_rom in same line.
Then break it into 2 different lines
int get_value(void);
int get_rom(void);
To Enocde code tags use the # menu in the window.
raghu
It's supposed to be a function that converts roman numerals to their hindu arabic value (or is it the other way around). By the way, I tried separating them into two declarations and I still got the same error
I actually have a school project: Write a program that will allow the user to enter an Arabic number or a Roman number and then your program will convert it to the opposite (Arabic or Roman).
@Jhei
So you're supposed to write a function (according to your assignment) and all you do is roam the internet, dig up a piece of crappy code (which you don't understand) and expect us to do your work?
One hint: that code is not just syntactically incorrect, logically it can't convert roman numbers either. Maybe just a single roman digit; throw it away and start writing yourself.
kind regards,
Jos
Someone's in a bad mood.. that's not really what i'm here for though, i was only asking why there was a declaration syntax error in the code.. i know that was for a single roman numeral only code, the error was all i was asking about and how to somehow correct it
The compiler is complaining because of the ;. By putting semi-colon there you are declaring (as oposed to defining) a function. For reference, google C++ FAQ lite.
Why it doesn't complain about an invalid character right behind get_value(void) is a mystery.
int get_value(void), get_rom(void);
{ ...
Just what are you trying to do here?
If you want to define a function named get_rom, you should replace all this with
int get_rom() // note the absense of ;
{ ...
Oh and, don't return from a function with void return type.
well, one lil question, how do you put an overline on roman numeral thousands place that are higher than 3? is it even possible
well blah, am done with the arabic to roman part..
now i have no idea how to do the roman to arabic numeral conversion, any suggestion?
@Jhei
Good for you; don't you think it's time to show us what you have done (just a bit of courtesy) so that you don't exhibit yourself as just another code beggar?
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Morten Gulbrandsen |
last post by:
C:\mysql\bin>mysql -u elmasri -pnavathe company
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 29 to server version: 4.1.0-alpha-max-debug
Type...
|
by: xuatla |
last post by:
Hi,
I encountered the following compile error of c++ and hope to get your help.
test2.cpp: In member function `CTest CTest::operator+=(CTest&)':
test2.cpp:79: error: no match for 'operator='...
|
by: Patrick Masson |
last post by:
Hello,
Our configuration :
Apache 2.0.53
PHP 5.0.4
PC Windows 2000
MATLAB 6.1
We work on a consulting project in France which involves MATLAB Web server,
|
by: Steve |
last post by:
I have several pairs of synchronized subforms in an application. I have a Delete
button for each pair that uses the following code or similar to delete a record
in the second subform:
...
|
by: intl04 |
last post by:
I am getting strange print-related error messages when trying to
create (not print!) reports. For example, when I click 'new' to create
a report then choose 'design view', I get an error message...
|
by: tyler_durden |
last post by:
thanks a lot for all your help..I'm really appreciated...
with all the help I've been getting in forums I've been able to continue
my program and it's almost done, but I'm having a big problem that...
|
by: vfunc |
last post by:
I get an undefined reference error for a definition that clearly looks
like it is in a .h file. So
what can be the cause of an undefined reference error, when this .h
file containing the...
|
by: deathtospam |
last post by:
My employer is starting to take the first steps towards migrating its
Classic ASP codebase to ASP.NET v2.0. We have a copy of our existing
website on the new Windows Server 2003 R2 test server,...
|
by: hyperpau |
last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding.
I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com).
Ergo, I...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| | |