Forum: C++ Jul 9th, 2008 |
| Replies: 13 Views: 2,444 You may study programming languages like FORTH or Postscript how they do computing using stacks.
tesu |
Forum: C++ Jun 26th, 2008 |
| Replies: 23 Views: 4,243 Hello Shaun32887
following is a small class what has been posted by a programming virtuoso here in forum on daniweb.com. Unfortunately, I have not recorded his name.
//
// String passing... |
Forum: C++ Jun 24th, 2008 |
| Replies: 6 Views: 1,044 instead of: int i = ch; // stores same code in an int (wrongly)
you might try: int*i =(int*)ch;
then
cin>>ch; // enter A for example
cout << ch; // gives A
cout << i; // gives 0x41... |
Forum: C++ Jun 23rd, 2008 |
| Replies: 6 Views: 1,044 Hi
Your code:
char ch;
int i = ch;
You didn't assign a value to ch. So i is undefined. Also this would not work if you do cin >> ch.
You may try this instead:
char xxx = 'x'; |
Forum: C++ Jun 22nd, 2008 |
| Replies: 8 Views: 831 Well dear Superfat, the most effective solution for you problem has already been given by vijayan121. Unfortunately you aren't able to understand his fine function. So GOD's advice should be... |
Forum: C++ Jun 18th, 2008 |
| Replies: 6 Views: 1,863 sorry, completely nonsense what I wrote ! so forget it.
true, new <--> delete and malloc <--> free
sorry for telling that nonsens
krs,
tesu |
Forum: C++ Jun 18th, 2008 |
| Replies: 6 Views: 1,863 Hi mrboolf,
Consider your constructor and destructor:
In C++ memory is allocated by applying "new". Its partner is "free" ! You should never apply "delete", which is plain C, on memory... |
Forum: C++ Jun 16th, 2008 |
| Replies: 12 Views: 2,572 Hi niek_e
You are right, I have overlooked the semicolon at he far right.
Intuitively I also would put a semicolon at left side if for-init statement is off. But the ISO standard tells the... |
Forum: C++ Jun 16th, 2008 |
| Replies: 12 Views: 2,572 Hi QuantNeeds
Your for loop is correct. It corresponds completely with the Standard ISO/IEC 14882:1998(E) of C++. So your compiler seems to be something outdated, especially the phrase... |
Forum: C++ Jun 8th, 2008 |
| Replies: 6 Views: 3,650 Hi all,
though Ancient Dragon has already answered almost every question, I would like to put in my twopenn'orth too.
-Why use the stack of the space is so limited?
Stack is not that... |
Forum: C++ May 28th, 2008 |
| Replies: 5 Views: 863 Hi yap,
replace cin.get() by these
This works fine for gcc programs.
krs,
tesu |
Forum: C++ May 27th, 2008 |
| Replies: 12 Views: 1,873 If I were God first I would create new universe to be able to store quintillion figures of those numbers because Milky Way obviously too small. Then I would install just one quintillion hyper... |
Forum: C++ May 26th, 2008 |
| Replies: 12 Views: 1,873 Oh, not that large, only 10 power 30 !
Possibly you need something badly better than fft :icon_mrgreen: (n*ld(n)) |
Forum: C++ May 22nd, 2008 |
| Replies: 15 Views: 1,460 Possibly, you don't know what you should change in your function to get it function correctly. These are your problems in binaryAdd of posting #7:
1. Serious problem (where you begin when you are... |
Forum: C++ May 22nd, 2008 |
| Replies: 15 Views: 1,460 I am not that sure whether your question deals with my post #9, does it? Are there problems like how-to-change formal parameters of the function declaration or don't fit your actual parameters when... |
Forum: C++ May 20th, 2008 |
| Replies: 15 Views: 1,460 Hi buddy1,
here is some code what might meet your assignment.
In your main() you write:
// Binary addition
const int a[8] = { 0, 1, 1, 1, 1, 1, 1, 1 };
const int b[8] = { 0, 0, 1, 1, 1, 1,... |
Forum: C++ May 18th, 2008 |
| Replies: 12 Views: 1,873 GMP is uniquely great. Yet, how large is very large integer? |
Forum: C++ May 17th, 2008 |
| Replies: 12 Views: 4,812 hi shknahs,
you may also try this:
void rev_str(string str,int n)
{
if(str[n]!='\0')
rev_str(str,n+1);
cout<<str[n-1];
}
// result: shknahs |
Forum: C++ May 13th, 2008 |
| Replies: 2 Views: 1,901 hi,
static member must be initialized outside of class declaration, for example below }; of class def:
class C
{
public:
static int st;
...
}; |
Forum: C++ May 12th, 2008 |
| Replies: 5 Views: 561 hi,
"17" ascii ?
"1" = 41hex (4th column, 1st row) = 0100 0001bin
"7" = 47hex (4th column, 7th row) = 0100 0111bin
17
76543210 |
Forum: C++ Apr 17th, 2008 |
| Replies: 11 Views: 1,500 ofstream is for output, which can be combined with fstream::out | fstream::app // for append
but not with fstream::in | fstream::out
if you want to do both, use fstream.
you may have a look at ... |