Forum: C++ Aug 31st, 2006 |
| Replies: 7 Views: 1,794 Your explanation was very usefull. I have one more doubt in the same context.
This assembly thing is quite new for me. In the cpp assembly line 7 states push 10.
So does that mean in Cpp the... |
Forum: C++ Aug 31st, 2006 |
| Replies: 7 Views: 1,794 Can you tell me where the variable be put when it is declared as const. Will it go into const segment.
"You can also specify sections for initialized data (data_seg... |
Forum: C++ Aug 31st, 2006 |
| Replies: 7 Views: 1,794 I have executed the below programm on both C and C++ compiler and got different results
#include <stdio.h>
int main()
{
const int a=10;
int *p=(int*)(&a);
*p = 20;
printf("address... |
Forum: C++ Aug 12th, 2006 |
| Replies: 8 Views: 3,706 Good explanation.
Thanks Dave |
Forum: C++ Aug 12th, 2006 |
| Replies: 8 Views: 3,706 Link to draft copy
http://www.csci.csusb.edu/dick/c++std/cd2/index.html |
Forum: C++ Aug 12th, 2006 |
| Replies: 8 Views: 3,706 So .... R you trying to say that its a standard ...
If at all its a standard, there should be some reason as of why the standard is not allowing it |
Forum: C++ Aug 12th, 2006 |
| Replies: 8 Views: 3,706 That link doesn't provide the reason why the program crashes if the object is on stack. |
Forum: C++ Aug 11th, 2006 |
| Replies: 8 Views: 3,706 Hi All,
Can we delete this pointer from a member function.
I have written three programs to try this. The first two crashes at run time while the third doesn't. Can somebody explain me... |
Forum: C Aug 10th, 2006 |
| Replies: 3 Views: 2,390 Agreed to that ... Can you make it clear, when the initialization of virtual pointer with the address of virtual table will take place??? |
Forum: C Aug 10th, 2006 |
| Replies: 3 Views: 2,390 Why cant we have a virtual constructor?
All the materials give somewhat similar anwer to this question. "First the VPTR Pointer is initialised to it's proper VTABLE by the contructor which is... |
Forum: C++ Aug 8th, 2006 |
| Replies: 16 Views: 4,909 |
Forum: C++ Aug 8th, 2006 |
| Replies: 16 Views: 4,909 This explanation was very much usefull.Thank Wolf ..... Can you provide me the link to C++ standards. |
Forum: C++ Aug 8th, 2006 |
| Replies: 16 Views: 4,909 Hi Guys,
I still didn't get answer for my question.
By reference to pointer I mean this
int * & x;
Here x is a refernce to a pointer
In the same way pointer to a reference is not... |
Forum: C++ Aug 7th, 2006 |
| Replies: 16 Views: 4,909 Why pointer to a refernce is not allowed in C++????? |
Forum: C++ Aug 3rd, 2006 |
| Replies: 2 Views: 1,113 const int m=3;
const int n=4;
const int p=5;
int A[m][n];
int B[n][p];
Put your initializations inside main if you are using it locally or above main(global usage) if it is used in more... |
Forum: C++ Aug 3rd, 2006 |
| Replies: 16 Views: 15,097 This is one way of going about it without much thinking
fn = [ Phi^ n - (-Phi)^-n ] / (2Phi-1)
for smaller values of n you need approximation.
Phi = ( 5^½ + 1 ) / 2 = 1.6180339 (the golden... |
Forum: C++ Aug 2nd, 2006 |
| Replies: 10 Views: 2,258 Have you checked your prog. The program is switching between am and pm.
I gave the input as 5 30 am and time difference 9. The o/p I got is 2:30pm. This is infact correct. Then why you are saying... |
Forum: C++ Aug 2nd, 2006 |
| Replies: 10 Views: 2,258 You should put equihrs=equihrs-12;
inside this if also
if(equihrs==12)
Other than that I dont see any problems |
Forum: C Aug 2nd, 2006 |
| Replies: 19 Views: 2,514 Some general advice
1) Donot use clrscr(), getch, gotoxy and all.....
2) Use prototype of main as int main(void) ( The one comment I usually get from the forum) or int main(int argc,... |
Forum: C Aug 2nd, 2006 |
| Replies: 11 Views: 1,454 l_var = l_var | (int)pow( 2, Array[i]);
What is the problem with this if I am making check for 30????? |
Forum: C Aug 2nd, 2006 |
| Replies: 11 Views: 1,454 Suppose in the array all 1, 2, 3 and 4 are present now after the operation
l_var = l_var | (int)pow( 2, Array[i] );
= pow( 2, 1) | pow( 2, 2)| pow( 2, 3) | pow( 2, 4)
= 2 | 4 | 8 | 16
= 10... |
Forum: C Aug 2nd, 2006 |
| Replies: 11 Views: 1,454 This seems to be a good sol. But should I check for 15 or 30 at the end
10
100
1000
10000
-----------
11110 -- 30 (dec)
Right?? |
Forum: C Aug 2nd, 2006 |
| Replies: 11 Views: 1,454 Array can contain 1,2,3 and 4 any number of times. Its not necessary that array has all the four. But if all the four are present then the function should return true otherwise false. |
Forum: C Aug 2nd, 2006 |
| Replies: 11 Views: 1,454 What if only 1 is present 5 times ??? Then also the count will be greater than 4 |
Forum: C Aug 2nd, 2006 |
| Replies: 11 Views: 1,454 I have to write a function which takes an integer array as input and it should return true if the array contains 1,2,3 or 4.
Conditions
1) The function should pass thru array only once.
2) Can... |
Forum: C Aug 2nd, 2006 |
| Replies: 3 Views: 1,201 "If a character is a string, change it to an underscore"
I guess Dave meant
"If a character is a space, change it to an underscore" |
Forum: C Aug 2nd, 2006 |
| Replies: 28 Views: 2,876 Thank you all for your suggestions.
hollystyles - Good material. |
Forum: C Aug 1st, 2006 |
| Replies: 28 Views: 2,876 Using one directive the output is as I am expecting.
In this case it will give redefinition error. But when I use two not able to figure out what is happening |
Forum: C Aug 1st, 2006 |
| Replies: 19 Views: 2,514 Here are some problem with your code
1)
printf("last name:");
scanf("%s",ln[i]);
replace it like
printf("last name:");
scanf("%s",ln); |
Forum: C Aug 1st, 2006 |
| Replies: 19 Views: 2,514 Which compiler are you using??? |
Forum: C++ Aug 1st, 2006 |
| Replies: 2 Views: 1,791 I hevent gone thru your code ... You can do something like this
Random Number % Number chosen == 0
then
proceed
else
choose other random number. |
Forum: C Aug 1st, 2006 |
| Replies: 28 Views: 2,876 Are you sure about this. I just want to confirm .... Do you know any good materials on this. |
Forum: C++ Aug 1st, 2006 |
| Replies: 2 Views: 877 Modify your MarkNumber as shown below.
void MarkNumber(int input)
{
int loop=input ;
while (loop >= 10)
{
cout<<"0123456789";
... |
Forum: C Aug 1st, 2006 |
| Replies: 28 Views: 2,876 int main(void)
{
int a = 20, b = 30;
printf("%d %d", a , b );
}
But why there is no change in the preprocessor output ( see above) ??? |
Forum: C Aug 1st, 2006 |
| Replies: 28 Views: 2,876 #include <stdio.h>
#define a b
#define b a
int main(void)
{
int a = 20, b = 30;
printf("%d %d", a, b);
} |
Forum: C Aug 1st, 2006 |
| Replies: 28 Views: 2,876 Output will be 20 30, This seems to straightforward for me. |
Forum: C Aug 1st, 2006 |
| Replies: 28 Views: 2,876 #include <stdio.h>
#define a b
#define b a
int main(void)
{
int a = 20, b = 30;
printf("%d %d", a, b);
} |
Forum: C Aug 1st, 2006 |
| Replies: 6 Views: 1,161 Sorry Knorden ... Me too got it
Solution is simple.....
Instead of using for(i = 1; i < = numJobs; i++) use
for(i = 1; i < numJobs; i++)
The array was going out of bound. |
Forum: C Aug 1st, 2006 |
| Replies: 6 Views: 1,161 I tried running the same code but didnt got any segmentation fault.
Just changed the prototype of main and try it |