Search Results

Showing results 1 to 40 of 1000
Search took 0.17 seconds.
Search: Posts Made By: Ancient Dragon
Forum: C++ 2 Hours Ago
Replies: 2
Views: 41
Posted By Ancient Dragon
simple colution

int main()
{
int num;
char chars[] = "abcdefghijklmnopqrstuvwxyz";
cout << "How many strings do you want to create?\n";
cin >> num;
long n = 0;
...
Forum: C++ 2 Hours Ago
Replies: 2
Views: 29
Posted By Ancient Dragon
On my computer Alt+2 generages '☻', not ^B
Forum: C++ 2 Hours Ago
Replies: 1
Views: 34
Posted By Ancient Dragon
It should exchange the value of the two variable parameters. The two parameters are passed by reference (http://www.brpreiss.com/books/opus4/html/page593.html) so that swap() can change them and the...
Forum: C 11 Hours Ago
Replies: 1
Views: 59
Posted By Ancient Dragon
>>is it a standard one?
Yes -- all compilers are required to implement it like that. Here (http://en.wikipedia.org/wiki/ANSI_C) is info about ansi c standards

>>the array name cannot be changed...
Forum: C++ 21 Hours Ago
Replies: 5
Views: 95
Posted By Ancient Dragon
You can solve for pc first in a similar manner that I posted. I think the problem in ComputerMove() is that if a square is already eith 'x' or 'o' you need to generate another random number and try...
Forum: C++ 21 Hours Ago
Replies: 5
Views: 171
Posted By Ancient Dragon
It doesn't make a lick of sense to write a custom print function for every conceivable data type using printf() or fprintf(). cout, ofstream and ifstream already have overloaded functions that do it...
Forum: C++ 22 Hours Ago
Replies: 5
Views: 95
Posted By Ancient Dragon
This minor change made it work when I move first

if (choice==1) //if player wishes to go first
{
bool done = false;
do{
...
Forum: C 23 Hours Ago
Replies: 10
Views: 195
Posted By Ancient Dragon
Oh I see -- I guess I misunderstood. You would have to sort the list after it was finished. When sorting linked lists just exchange the actual data, not the entire nodes, to preserve the link...
Forum: C 23 Hours Ago
Replies: 3
Views: 101
Posted By Ancient Dragon
If all you want to do is run that program once when what' the point of making the text file into a fixed-length records? Such a scheme would limit the usefullness of your program.
Forum: C 23 Hours Ago
Replies: 2
Views: 106
Posted By Ancient Dragon
where is your code? No one here will write that program for you.
Forum: Geeks' Lounge 1 Day Ago
Replies: 7
Views: 123
Posted By Ancient Dragon
Not really my "favorite", but Wanted is a very very good action movie. If you liked Die Hard you will also like Wanted.

I suppose my favorite was Dune. I wore out two tapes because I watched it...
Forum: C++ 1 Day Ago
Replies: 2
Views: 92
Posted By Ancient Dragon
what compiler are you using? I compiled/ran with vc++ 2008 express and your first program worked ok.
Forum: C 1 Day Ago
Replies: 10
Views: 195
Posted By Ancient Dragon
Change AddWord() to add the new node in ascending or descending order. Then you won't have to bother about sorting later.
Forum: C 1 Day Ago
Replies: 5
Code Snippet: Linked List
Views: 160
Posted By Ancient Dragon
1) remove conio.h -- its non'standard and not implemented by very many compilers. Code snippets should not use compiler-specific stuff.

2) delete all those global variables on lines 12 and 13. ...
Forum: C++ 1 Day Ago
Replies: 2
Views: 91
Posted By Ancient Dragon
>>mysql_result[3000][2]=msq_row;

If you programmed the rest of that then you should probably know that the above like doesn't work. You should be reading this tutorial...
Forum: C++ 1 Day Ago
Replies: 14
Views: 285
Posted By Ancient Dragon
Why didn't you just convert flavor to lower case instead of creating yet another variable?
Forum: Geeks' Lounge 1 Day Ago
Replies: 19
Views: 317
Posted By Ancient Dragon
I suppose that means playing a game is more important than doing homework.
Forum: C++ 1 Day Ago
Replies: 4
Views: 171
Posted By Ancient Dragon
>>The changes you mentioned have been made except for changing ! == to !=. For some reason, my compiler is not liking !=. I get the error "ISO C++ forbids comparison between pointer & integer". I'm...
Forum: C++ 1 Day Ago
Replies: 11
Views: 191
Posted By Ancient Dragon
could be re-written like this: Notice you don't need || at all. And that function should only have a return statement at the end of the function, not on every line.

char grade;
...
Forum: C 1 Day Ago
Replies: 3
Views: 101
Posted By Ancient Dragon
You don't have to store all the lines, just the two lines that you want to compare. Sequentially read the file, counting lines as you go along then save only the two lines you want to compare.
Forum: C++ 1 Day Ago
Replies: 4
Views: 171
Posted By Ancient Dragon
line 7 and 8 of the read function: Line 8 is unnecessary because line 7 opens the file when the stream is declared.

line 12: if lastname never contains spaces then use use >> operator instead...
Forum: C++ 1 Day Ago
Replies: 4
Views: 114
Posted By Ancient Dragon
c++ has std::string that is declared in <string> header file. google for std::string and you will find links that describe all its methods.
Forum: C++ 1 Day Ago
Replies: 4
Views: 114
Posted By Ancient Dragon
There are two problems on each of those lines
1) one, two, three, etc are not defined in that function.

2) char is a data type, but you failed to provide a variable name. For example char...
Forum: C++ 1 Day Ago
Replies: 6
Views: 136
Posted By Ancient Dragon
void swap(int* int1, int* int2)
{
int temp = *int1;
*int2 = *int1;
*int1 = temp;
}


void sort(int int1, int int2, int int3)
{
Forum: C++ 1 Day Ago
Replies: 4
Views: 163
Posted By Ancient Dragon
Deposit $10,000.00 USD in my paypal account and I'll do it for you. Otherwise you will just have to write the program yourself.
Forum: C++ 2 Days Ago
Replies: 1
Views: 97
Posted By Ancient Dragon
>>The program was initially written in VC++

VC++ is not a computer language. Its an IDE/compiler. So saying you are converting from vc++ to c++ is nonsense.
Forum: C++ 2 Days Ago
Replies: 5
Views: 171
Posted By Ancient Dragon
better off replacing that fprintf() with c++ fstream class so that the compiler won't complain so much.
Forum: C++ 2 Days Ago
Replies: 3
Views: 92
Posted By Ancient Dragon
If you use string, then use find() to locate the space, and substr() to extract the characters from position 0 to the location returned by find().
Forum: C 2 Days Ago
Replies: 10
Views: 195
Posted By Ancient Dragon
delete line 56 -- it does nothing.
Forum: C 2 Days Ago
Replies: 10
Views: 195
Posted By Ancient Dragon
Why did you use fgets() instead of fscanf()? fgets() gets the entire line without regard to spaces, which is not what you want. Look at the simple code I posted, it does what you need. All you...
Forum: C++ 2 Days Ago
Replies: 6
Views: 136
Posted By Ancient Dragon
Its a lot easier to sort them if you use an array of 3 integers instead of 3 individual variables.

int arry[3] = {0};
for(int i = 0; i < 3; i++)
{
cout << "Enter an integer\n";
cin >>...
Forum: C++ 2 Days Ago
Replies: 11
Views: 191
Posted By Ancient Dragon
You now have all the pieces you need, all you need to do now is put them together. In your original program, just delete lines 19-45 because they are not necessary. Then just write a simple for...
Forum: C 2 Days Ago
Replies: 11
Views: 210
Posted By Ancient Dragon
Yes. Its not really all that big a deal since the program has reserved space for the data anyway. Even though you have the arrays declared in if statements the compiler will allocate memory for all...
Forum: C++ 2 Days Ago
Replies: 1
Views: 104
Posted By Ancient Dragon
Yet Another Compiler Compiler (YACC) (http://dinosaur.compilertools.net/yacc/index.html)
Forum: C++ 2 Days Ago
Replies: 3
Views: 134
Posted By Ancient Dragon
Is a core file produced? Yes, then use dbg on that core file and it will tell you where the crash occurred.
Forum: DaniWeb Community Feedback 2 Days Ago
Replies: 0
Views: 99
Posted By Ancient Dragon
When I hit the Edit button to edit a post there is another active Edit button. Can you remove that button because its confusing.
Forum: C 2 Days Ago
Replies: 10
Views: 195
Posted By Ancient Dragon
>>The program is supposed to take in a file provided through standard input
That means get the name of the file from standard input, not the lines of the file. You have to open the file and read...
Forum: C 2 Days Ago
Replies: 1
Views: 135
Posted By Ancient Dragon
Modern 32-bit compilers to not support that header file because it was intended for 16-bit MS-DOS 6.X and earlier operating systems. The alternative is to use win32 api functions OpenFile() to open...
Forum: C 2 Days Ago
Replies: 11
Views: 210
Posted By Ancient Dragon
Yes it does work.



Read the file into the array just like it was any other normal text file.
Forum: C 2 Days Ago
Replies: 11
Views: 210
Posted By Ancient Dragon
>>Is there anyway to achieve this?
No because the #inc lude directive is processed at compile time, not runtime.
Showing results 1 to 40 of 1000

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC