|
I want to write a console application, Which will convert arabic numbers to roman.
But the problem is in roman 5000,10000 etc will be represented as V and a "-" symbol upon V..but i dont how to get these characters please let me know how to write a string a "-" upon them.
Please note that this is for console application
Its very urgent
|
|
|
|
|
Sounds like a class assignment for a computer science class...
GetOn&GetGoing wrote:
5000,10000 etc will be represented as V and a "-" symbol upon V
What do you mean, the fact that the roman numeral for five is a V with exaggerated serifs?
|
|
|
|
|
Ya i got it...
But how you will represnt 5000 you cant represent with "MMMMM", you should represnt as V and a "-" on that, i dont know how to print this kind of special characters in console application.
|
|
|
|
|
Ok, so a horizontal line over the roman numeral V is supposed to represent the fact that the number is multiplied by 1000. I think that that usage isn't really in vogue any more, but if it is necessary, how about writing an underscore ("_") on the line above the value?
|
|
|
|
|
Ya that will be fine with me...
But how to do that for a consle application
|
|
|
|
|
Ok, you know that you generate output in a console application with Console.Write() and Console.WriteLine() , right?
So, figure out which position of your roman number is the 1000's, then write an underscore on the line before you write the roman numerals:
Console.WriteLine("_");
Console.WriteLine("VCXIX");
|
|
|
|
|
Can any body send me the interview questions..I dont want direct questions
I wan the questions which are very tricky and concptual....
|
|
|
|
|
Try Programming Interviews Exposed (Mongan & SUojanen) published by Wiley.
|
|
|
|
|
I think you missed a forum hear
But if this is somehow C# related please be more specific!
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
CWIZO wrote:
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
LOL
|
|
|
|
|
Thanx, made that ups myself
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
I am using a numericUpDown control which represents a minutes (for time) value. I want it to display 00, 01, 02, etc... for numbers less than 10. Is there a simple way to do this with a property (I reviewed the documentation, but didn't see anything immediately)?
I know I could do it if I inherit the control, but I was hoping for a simple property or somethign to accomplish it. Something that I missed in the documentation.
Can it be done without inheriting it?
There are only 10 types of people in this world....those that understand binary, and those that do not.
|
|
|
|
|
The property you are looking for is not available.
|
|
|
|
|
No property like this is available, but if you extend NumericUpDown you can simply override UpdateEditText . If Hexidecimal is set, be sure to call the base.UpdateEditText unless you want to handle this yourself. Also, when formatting the number, don't forget to take the ThousandsSeparate into account.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank Heath...that's kind of what I thought. I figured I'd have to inherit/extend it to make it work. I just wanted to make sure there wasn't a property for it that I missed before I went through all the trouble.
There are only 10 types of people in this world....those that understand binary, and those that do not.
|
|
|
|
|
I take it that you looked at the class documentation for the NumericUpDown class, right? Deriving from your sig, "there are 10 types of people in this world...those that read the documentation and those that do not." (Unfortunately, most of the posters here fall in the latter category.)
Typically, you can learn everything you need to know from the docs (add that to experience and reading articles on MSDN, CodeProject, et. al.). If some member overrides a base member of defined new and you find the documentation a little lacking on details, use ildasm.exe - the IL disassembler that comes with the .NET Framework SDK - to view the IL for the implementation in that assembly, or use a good decompiler like .NET Reflector[^] (though its decompiler rarely incorrect / incomplete). You can learn a heck of a lot that way - perhaps even pick up a few pointers from the developers at Microsoft who wrote the base class libraries.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Yes, I did read the documentation, the problem is that Microsoft documentation isn't always as solid as it could be. Once you've "done it", then you see in retrospect how to "do it", but that doesn't mean the documentation just explains every nuance. Far from it usually. That was why I said up front that I knew it was possible if I inherited the class, but wanted to make sure there wasn't a proprety or something like that I was missing.
I'll keep that in mind about the ildasm.exe....I remember you showing me that on the COM DLL problem I had last week.
There are only 10 types of people in this world....those that understand binary, and those that do not.
|
|
|
|
|
#include <stdio.h><br />
#include <stdlib.h><br />
#include <string.h><br />
<br />
typedef struct<br />
{<br />
char *item[100];<br />
int top;<br />
}strstk, *strstkptr;<br />
<br />
char *chartostr(char);<br />
char *process(strstkptr);<br />
char *pop(strstkptr);<br />
void push(strstkptr, char *);<br />
<br />
int main()<br />
{<br />
strstkptr pS=(strstkptr)malloc(sizeof(strstk));<br />
char *p;<br />
char buf[100];<br />
char *pV;<br />
<br />
while(scanf("%s", buf) !=EOF){<br />
switch(buf[0]){<br />
case '(':<br />
case '+':<br />
case '*':<br />
p=chartostr(buf[0]);<br />
push(pS, p);<br />
break;<br />
case ')':<br />
pV=process(pS);<br />
if(pS->top==0)<br />
printf("%s ", pV);<br />
else<br />
p=malloc(100);<br />
sprintf(p,"%d", pV);<br />
push(pS, pV);<br />
break;<br />
default:<br />
break;<br />
}<br />
}<br />
<br />
}<br />
<br />
char *pop(strstkptr pS)<br />
{<br />
return pS->item[--pS->top];<br />
}<br />
<br />
void push(strstkptr pS, char *pV)<br />
{<br />
pS->item[pS->top++]=pV;<br />
}<br />
<br />
char *process(strstkptr pS)<br />
{<br />
char *p, *py, *px;<br />
<br />
while((p=pop(pS)) != "("){<br />
if(p="*"){<br />
py=pop(pS);<br />
px=pop(pS);<br />
<br />
}<br />
else<br />
py=pop(pS);<br />
px=pop(pS);<br />
<br />
<br />
<br />
} <br />
}<br />
<br />
char *chartostr(char ch)<br />
{<br />
char *p=malloc(2);<br />
p[0]=ch;<br />
p[1]=0;<br />
return p;<br />
}<br />
I don't know know how I'm supposed to to add or multiply from my stack can anybody help
|
|
|
|
|
C# discussions
Methinks you're not going to get much help here. Try here[^]
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
Support Bone
It's a weird Life
|
|
|
|
|
Hi,
I would like to convert a string of numbers to an integer. I know in C it used to be atoi() but I don't know the equivalent in C# if it exists.
Thanks,
Talal
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
you can use the following statement:
int num = int.Parse(yourStringofNumbers, NumberStyles.Integer)
but declare:
using System.Globalization
|
|
|
|
|
|
Thanks! I'll give it a try.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Hello everyone,
I have few crystal reports in a project. I need to combine all the reports in one pdf. I can print each report in one pdf file but need to combine all of them in one. Any help would be highly appreciated
Thanks in advance
Ali
|
|
|
|
|
Hi, I looking for :
1/ blinking a Row of ListView;
2/ Show the last row inserted in the ListView when inserted a rnew row.
Best Regards
youssef
|
|
|
|