Forum: C++ 6 Days Ago |
| Replies: 4 Views: 184 you will need to set up the variable values for numerator and the denominator using 2 different for loops
and then compute numerator/denominator.. after which you send it up. |
Forum: C++ Oct 31st, 2009 |
| Replies: 9 Views: 357 apart from what A.D said, to get a little technical, you may want to try the peek() function. Check if that character is an alphabet or a number. if its a number . take in the number with the >>... |
Forum: C++ Oct 31st, 2009 |
| Replies: 11 Views: 493 Or another thing you can do is to call the grade function from Average (). |
Forum: C++ Oct 29th, 2009 |
| Replies: 8 Views: 539 This is perfectly right !! Nice, work figuring out the suggestion of FirstPerson . |
Forum: C++ Oct 27th, 2009 |
| Replies: 6 Views: 256 Yes, its a mere notational advantage .
This applies to both for loops and if statements.
If the curly braces { } are absent. the loop only executes the next line.
for(j=2; j<=i/2; j++)
... |
Forum: C++ Oct 27th, 2009 |
| Replies: 6 Views: 256 Well this program is not as complex as it seems to be.
for(i=1; i<=100; i++)
The first for loop runs from 0 to 100, and runs a test for checking whether its prime or not.
Then in the... |
Forum: C++ Oct 27th, 2009 |
| Replies: 5 Views: 277 I wonder if it is compulsary to use new to allocate variable space. Since it is only one. Why dont you just declare a variable. That way you will not need to worry about deleting. as the Destructor... |
Forum: C++ Oct 21st, 2009 |
| Replies: 3 Views: 327 Remove the declaration of the variable int i=0; from line 14 and place it in between 33-34 or 34-35.
The problem is that the scope of the variable which retains the value of 11 after the first... |
Forum: C++ Oct 6th, 2009 |
| Replies: 21 Views: 693 Well its pretty unclear for me to understand this, Please Post down the Input , Desired Output and Current Output. That way it would be easy. |
Forum: C++ Oct 5th, 2009 |
| Replies: 5 Views: 230 Well, we appreciate that you are trying to put-in effort. But We would require you to make an attempt at cracking the solution yourself. Then when you have an attempt, we could then come in and get... |
Forum: C++ Oct 5th, 2009 |
| Replies: 21 Views: 693 Shoudnt Line 12 be
the reverse newNode->info=i->info;
And could you explain what line 15 is doing? |
Forum: C++ Oct 5th, 2009 |
| Replies: 5 Views: 230 Firstly you are looking at different operations.
1) Maintain A Database, That's pretty much done, when you have a excel spreadsheet which you can later convert into CSV (Comma separated Value )... |
Forum: C++ Oct 5th, 2009 |
| Replies: 21 Views: 693 If both are of type string, you could just use the "=" operator and completely avoid strcpy. |
Forum: C++ Oct 5th, 2009 |
| Replies: 21 Views: 693 I dont understand why cant you use.
tempword=i->info; |
Forum: C++ Oct 5th, 2009 |
| Replies: 21 Views: 693 for(int i = first; i->link != NULL; i = i->link)
Check Line 4 in the code in your post. it consists the above code.You have declared variable i to be of type int then you use the -> operator .... |
Forum: C++ Oct 5th, 2009 |
| Replies: 4 Views: 297 Well in your question. You said that you need to use arrays. But You are not using any in your program. The best approach would be to analyse the question and think how you can use a index to get the... |
Forum: C++ Oct 2nd, 2009 |
| Replies: 4 Views: 280 Yes, Btw, Dont forget deleting each one of the dynamic pointers . Before you delete the pointer to pointer.
And yea, Loops could assign values.
Another solution would be to use vectors. |
Forum: C++ Oct 2nd, 2009 |
| Replies: 4 Views: 280 Well Dynamic 2D arrays take a little more complexity.This is mainly because when you declare something like this
int *p;
p= new int [2][2];
What you are trying to do is assigning a pointer... |
Forum: C++ Sep 16th, 2009 |
| Replies: 7 Views: 496 It is not that you are creating 5 strings of size 35, But actually Creating an 2-d array of 5 rows and 35 columns.
The size of the string is not constant and can extend as much as possible ,until... |
Forum: C++ Sep 13th, 2009 |
| Replies: 36 Views: 1,422 The main Problem in your code is that it replaces the letter "b" with the letter in UNICODE represented as "001A", which is the key to break the execution of the program. |
Forum: C++ Sep 12th, 2009 |
| Replies: 6 Views: 338 Yes, If you use the namespace. there is no need to inline the std:: |
Forum: C++ Sep 8th, 2009 |
| Replies: 9 Views: 360 Hehe, I guess SALEM's Right As Always ;)
Btw, For the OP, Here's a Tip that would help you out.
Check out how "Pointers work." If you figure that out, I guess you will find that its... |
Forum: C++ Sep 8th, 2009 |
| Replies: 16 Views: 787 >>what id i swap the num-- to --num what will that do??
-- is the decrement operator.
The Basic function of the Decrement operator is to decrease the value of the variable by 1.Thats pretty... |
Forum: C++ Sep 8th, 2009 |
| Replies: 6 Views: 338 http://www.cplusplus.com/reference/clibrary/cstdio/printf/
This is a complete explaination of the printf function . you will notice that %x or %X is denoted to show the hexadecimal notation.
... |
Forum: C++ Sep 2nd, 2009 |
| Replies: 2 Views: 659 The function toupper takes a character argument and returns a character. so you cant assign a string and expect to get back the string itself.
You will have to replace every letter in the string... |
Forum: C++ Aug 18th, 2009 |
| Replies: 15 Views: 496 I think it would work if you could change this
a->pVar=static_cast<int*>(passedVar);
to static_cast<int*>(a->pVar)=static_cast<int*>(passedVar);
The error you get is because you are... |
Forum: C++ Aug 18th, 2009 |
| Replies: 3 Views: 274 Yes, this is prettymuch the best way to do it, However if you could use the string library i guess it would be pretty easy with the use of + Operator. |
Forum: C++ Aug 18th, 2009 |
| Replies: 7 Views: 586 Well, Its quite simple, Use the same formula that you have in the existing code, But just change all the instances of '5' with a variable.
For Eg:
for(i=1; i<=5; i++)
This could be... |
Forum: C++ Aug 14th, 2009 |
| Replies: 12 Views: 592 That was just an attempt to show that there is an exception to default arguments.. |
Forum: C++ Aug 14th, 2009 |
| Replies: 1 Views: 209 inpa >>(name)>> (visit_duration) >> doctor;
your doctor class does not have a >> operator overloaded, hence the compiler places that error.
You can either define the operator, or change the value... |
Forum: C++ Aug 14th, 2009 |
| Replies: 12 Views: 592 Not necessaryly.
Well another alternative would be to give default values to your arguments for eg:
void funcname(int a, int b=0, int c=0);
Now i can just call the function in these 3... |
Forum: C++ Aug 8th, 2009 |
| Replies: 18 Views: 1,019 Are you getting an error?
What is the name of the file in which the class declaration is stored? |
Forum: C++ Aug 8th, 2009 |
| Replies: 18 Views: 1,019 Well, You have misunderstood the basic concept of a class
Employee Name[3] ={ "Susan Meyer", "Mark Jones", "Joy Rogers"};
Employee Idnumber[3] ={ 47899, 39119,81774};
Employee Department[3]... |
Forum: C++ Aug 2nd, 2009 |
| Replies: 3 Views: 339 Since you have already tried some methods. Just post down your existing code and maybe We can find where the problem is.
Or You can always use google :) |
Forum: C++ Jul 31st, 2009 |
| Replies: 5 Views: 347 It would become quite complex in testing a particular sudoku,for validity without using arrays.So i guess if you are allowed to use string, it would be the appropriate type, though it involves... |
Forum: C++ Jul 29th, 2009 |
| Replies: 4 Views: 214 Well I cant..........But I guess you can help yourself with some basics.
http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html |
Forum: C++ Jul 29th, 2009 |
| Replies: 4 Views: 214 I think this is an idea of what you actually need...
http://lmgtfy.com/?q=raw+sockets |
Forum: C++ Jul 16th, 2009 |
| Replies: 4 Views: 352 You can use stringstreams.
Here is the main algorithm which you can work on.
1 ) Get your number into a string.
2 ) replace the ',' with '.'
3 ) Then you can always put the number into the... |
Forum: C++ Jul 15th, 2009 |
| Replies: 2 Views: 249 If that is what you want, You are getting the right thing.
And where as this is considered.
INT x,y=6;
try the standard C++ int type
int x,y=6; |
Forum: C++ Jul 13th, 2009 |
| Replies: 8 Views: 614 Use a do while loop instead of the while loop and then you can add the getline inside the loop ,
do {
//getline here.
//other code here.
}while (!fsFile.eof());
So you read the file until... |