There must be a simple way to do this ?
Yeah, sure, use structures !
There must be a simple way to do this ?
Yeah, sure, use structures !
You could also use structures which you read from the file, everytime the program runs, and write the back to the file when the program has finished ...
But you can also use seekg() ...
It doesnt close when i run it
I think he's using Windows (not Linux or Unix or ...)
And in Windows you can just double click on the executable file and it launches, but in his case it will just appear and dissappear directly, if he started it from a console window (what you're doing) it isn't dissappearing ...
So it isn't compiler related ...
Oh, sorry I didn't read your question thoroughly ...
This is an example of a program which will always add the word 'something' at the end of the file:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
fstream filestr;
filestr.open ("test.txt", fstream::app);
// 'app' stands for append
filestr << "something\n";
filestr.close();
return 0;
}
You can also use this code with numbers ...
Hope this helps !
You can also use while(cin>>something);
(where something is a numeric datatype)
This instruction will read numbers until a non-numeric value was given ...
You just have to put the following instructions before return 0;
:
cin.ignore();
cin.get();
I think what you mean is RAD (= Rapid Application Development)
Consider using Microsoft Visual C++ or Borland Turbo Explorer ...
There are free editions for both of them ...
The following link describes in detail how to code edge detection yourself:
http://www.pages.drexel.edu/~weg22/edge.html
And maybe this link is useful too: http://www.intelliproject.net/articles/showArticle/index/image_proc_edge_detect
well integers in java can hold a lot bigger values than that infact if i am not wrong its even bigger than the one allocated in c/c++.
well if u still want bigger values then try using float or double.
And what about an unsigned long ?
int fact(int n) { if(n==1) return 1; else return (n*fact(n-1)); }
You can leave out the 'else' and I would like to advice you using another datatype than 'int' as factorials are quickly becoming large numbers (e.g.: the factorial of 10 is: 3.628.800) ...
You should process all pairs of integers and for each pair determine the maximum cycle length over all integers between and including i and j.
What do they actually mean by that ?
In fact it's a very simple program, you only have to use a for loop
(or recursion as I already stated)
You've to make something like a design plan first:
> You get the number where you want to calculate the factorial of from the user (store it in a variable)
> Now you use a for-loop to calculatate the factorial:
- Use for e.g. a for-loop with 'i' as index, you have to set it in such a way that 'i' is always incremented by 1 after a loop has been made ...
- The loop has to run n-times (where 'n' has to be the number where you want to calculate the factorial of)
- Now you declare a temporary variable (called 'result' for instance) and in each step of the for-loop you're multiplying it by 'i' (the index)
( result = result * i;
or result *= i;
)
- After the loop has finished you've the factorial ...
Note: Factorials are quickly becoming big so it might be useful to use an unsigned long for storing the factorial ...
I would use a struct called 'intPair' or something ...
With me the struct would look like:
struct intPair
{
int pair[2];
};
Then you're creating a table of structs: intPair input[3];
(now 'input' will be capable to hold three pairs of integers)
You can access the data like this:
// This example shows you how to set the first pair:
input[0].pair[0] = 10;
input[0].pair[1] = 20;
I actually don't understand your question ...
I think you mean the following, please say if I'm wrong:
-> I want to open a picture in Corel Draw using a program written in Visual Basic ...
Is that what you meant ?
In that case maybe the following information might be helpful for you: http://www.developerfusion.com/article/9/shell-and-shellexecute-function/
But you should adapt it to your needs ...
Hope this helps ...
We can't just give you some code away, sure we can solve this, but it's your homework ...
You should first show what you've done so far, and if you get stuck, you post your code and ask specific questions about it ...
In fact you could use a simple for-loop, but you could make your code even shorter by using recursion (recursion means that a function is calling himself ...)
On line 13, 16, 21 (of your function 'MultiSearc', code posted below) you're trying to access 'MyArray', but you aren't giving any subscript with it ...
You should add a counter to your loop and access the data in 'MyArray' using MyArray[counter]
...
I reposted your code:
void dSearch::MultiSearc(int MyFindItem, int MySize)
{
int center, left, right;
int indexes[MaxFound] = {{0}};
char status[8] = "Failed";
*indexes = -1;
left = 0;
right= MySize - 1;
while (( left <= right) && (strcmp (status, "Failed") ==0))
{
center = ( left + right )/2;
if ( MyArray == MyFindItem)
{
*indexes = center;
if (MyArray == MyFindItem)
{
*indexes = left;
strcpy ( status, "Success....!");
}
else if (MyArray > MyFindItem)
right = center -1;
else
left = center +1;
}
}
}
Hope this helps !
OK, in that case you are absolutely right !:)
Maybe you should post another source, which also isn't compiling under Solaris, but which you aren't using in your project ...
It's apparently a heat problem ...
Consider installing some extra coolers into your computer ...
You'll also have to remove that exploit from your computer ...
Maybe you should also try using another antispyware like Spybot S&D or Ad-aware Free ?
I'm just using CString variables wherein it holds the data.
How can I clear the value of a variable? I'm just using = ""; (ex. translated = ""; ). Is it enough to clear the memory?
It's only clearing the value of a variable, it's not releasing the assigned memory ...
I have recovery disks and used them to restore the system to company state.
But then also after some time, problem arises.
Rather looks like a hardware problem ...
> Consider running a diagnostic memory test/hard drive test ...
Normally you cannot use DELL Recovery CD's on other computer systems than DELL systems, as DELL verifies it
(something with an OEM-BIOS) ...
But normally you can buy a new recovery cd from HP ...
> Question:
Hi there Tabarak, Do you have your Windows Vista disc?
> Answer:
i dont even have the recovery discs...
If Vista came pre-installed on your laptop and no recovery disk(s) came with it, there might be a recovery partition somewhere on your hard disk ...
Yeah, I also agree with MrSpigot, you should consider to use an alternative design for your program as it will be really difficult and error-prone to do what you're asking for ...
Hello mimis, I've written a snippet to add two big integers ...
You can find it here ...
Hope this helps !
I've written a C++ class to estimate the roots of a number: you can check it out here ...
Maybe the following page might be helpful too:
http://en.wikipedia.org/wiki/Methods_of_computing_square_roots
Hope this helps !
Example of a For-loop:
for(int i = 0; i < 3; i++)
{
/* This loop will repeat 3 times */
}
Can your computer read other CD's?
You didn't give me an answer to that question ...
need help with a c++ problem
I think that was logic, but what's 'a' problem, we have to know what problem ...
In this case he has problems with some existing code ...
Ok, I know using an array is (a little) waste of memory, but if you do a quick math sum:
> 1MB = 1024 * 1024 Bytes = 1048576 Bytes
> An integer is maximum 4 bytes
> So, 1048576/4 = 262144
> Which means that in 1MB computer memory you can store a number of 262144 digits ...
> And today most computers have (I hope so) much more than 1MB RAM ...
It's a little waste of space, but much easier to code ...
If you really want to use your computer memory as efficient as possible you should work with strings (but it will be more difficult to code, but it is do-able) ...
You could also represent a big integer in an array, where each element represents a digit of the number ...
E.g: int bigint[12] = {1,5,6,9,7,2,3,4,5,1,0,2};
(which represents number 156972345102)
I think it's much easier to program if you use this method ...
Mmm, did you make a plan before writing your program ?
As you're writing an algorithm this is a very important thing to do ...
You have to describe step by step how YOU would do it, afterwards it's much simpler to code the algorithm, and you would also make less mistakes ...
What's your computer vendor?
Did Windows came pre-installed with your pc, in that case it came probably also with a recovery cd or a recovery partition (somewhere on your harddisk) ...
Consider looking it ('it' means 'how you have to restore your pc to the state in which it was bought') up in the support information of your computer, most computer vendors are hosting documentation on their sites so that can't be a big problem ...
In that case you'll have to implement your own algorithm ...
You can maybe try to implement the following:
When you do math and you have to make the sum of two big numbers, without using a calculator ...
What do you do ??
Well, you just sum up each digit with the corresponding digit of the other number ...
To give you an idea of what I mean:
Let's say you want to make the sum of 361 and 221, in that case you do the following:
|| 3 6 1
|| 2 2 1
= 5 8 2
You could also adapt this algorithm to your needs and use it with very big integers ...
You have analog algorithms for multiplying and dividing numbers ...
You could store the big numbers for e.g. in a string and convert it digit by digit, sum up the two digits and add the result each time to another string which holds the answer of the calculation ...
To hide all these operations it would be nice to implement your own class ...
Hope this helps !!
Hasn't there to be a 'while' after the '}' on line 33 ?
I don't know any C++ statement with only 'do', it think you meant the 'do while' ...
e.g.:
do
{
/* Your code here */
} while ( <condition> )
However, I assume his computer is powerful enough to run AVG, as he's installing Norton on it ...
Actually you could check if your computer can run any AV, just try Norton, if that works, the other AVs will also work ...;)
hello ppl
im new to C++
i was making a small newbie math quiz..
and was wandering how can i make it that at the end it says how much u got out of 10 or watever
Make use of a variable 'points' for instance and increase it by one every time a right answer has been given ...
This information about variables might be helpful ...
By the way I got Dev C++
if anyone knows of a better one please say so
I would use Code::Blocks instead (reason: Dev-C++ isn't being developed anymore (there are still some bugs in it), Code::Blocks is more advanced and up-to-date ...), but since you're a newbie programmer Dev-C++ will still fit your needs ...
Maybe you should check out the Ultimate Boot CD (which is probably useful in situations like this one): http://www.ultimatebootcd.com/download.html
Please check out the following C++ libraries:
> http://mattmccutchen.net/bigint/
> http://sourceforge.net/projects/cpp-bigint/
Yeah, we aren't writing programs for you, you first have to show some effort, post the code you already have ...
And if you don't know where to start then do the following: break the problem down into little parts which are simple to solve, then you put everything together and the big problem is solved ...
(this process is also known as abstraction)
OK, thank you very much for all your help, time, and useful advices ...
You could also search for "windows 2008 server"
on www.ebookee.com (the best resource for free ebooks about IT) ...
Probably not legal, but it's an answer to your question ...
! DO THIS ON/AT (which preposition do I use here ?) YOUR OWN RISK !
Maybe you should buy a book from Microsoft Press about that topic ...