Search Results

Showing results 1 to 40 of 1000
Search took 0.49 seconds.
Search: Posts Made By: Ancient Dragon ; Forum: C++ and child forums
Forum: C++ 5 Hours Ago
Replies: 4
Views: 93
Posted By Ancient Dragon
You can write files anywhere you want to on your computer as long as your login account has permissions to do that. For example newfile.open("c:\\dvlp\\test\\exemplu.txt");
Forum: C++ 2 Days Ago
Replies: 7
Views: 256
Posted By Ancient Dragon
If your target os supports standard iostreams then I'd use it. win32 api is very low level and supports only binary files -- yes text files can be written as binary files but using std::fstream...
Forum: C++ 4 Days Ago
Replies: 2
Views: 211
Posted By Ancient Dragon
The term "precompiled headers (http://en.wikipedia.org/wiki/Precompiled_header)" means something completely different than what you are trying to do. You are tring to create a library of...
Forum: C++ 5 Days Ago
Replies: 6
Solved: Scanf Issue
Views: 257
Posted By Ancient Dragon
Get the input data as a string, then your program can check its contents to see if it's numeric data or not. Since you are posting in the c++ forum I'd suggestion using cin and std::string, not...
Forum: C++ 5 Days Ago
Replies: 6
Solved: Scanf Issue
Views: 257
Posted By Ancient Dragon
scnaf with %d will only accept numeric data -- anything else is ignored and scanf() does not change the value of the input parameter. Check the return value to see if scanf() successfuly converted...
Forum: C++ 5 Days Ago
Replies: 3
Solved: dynamic array
Views: 200
Posted By Ancient Dragon
int* A = new int[10]; // dynamic array

int A[10]; // simple array


If you want the explanation in words, then I'd suggest you look them up in your text book. There are also a lot of online...
Forum: C++ 5 Days Ago
Replies: 6
Views: 218
Posted By Ancient Dragon
You can erase an element from the map, but you can't delete just one of the pointers because it belongs to an array. If you allocate the pointers one at a time then you could delete them in any...
Forum: C++ 7 Days Ago
Replies: 19
Views: 468
Posted By Ancient Dragon
I already told you the problem -- line 55 doesn't work because 0 is never > than MONTHS. You changed the wrong line. You should have changed line 45, not line 55. Put line 55 back the way it was...
Forum: C++ 7 Days Ago
Replies: 5
Views: 282
Posted By Ancient Dragon
What is wrong is that you are using some crappy compiler such as Turbo C to run an MS-Windows 32-bit program. Can't be done. Toss out that compiler and use a modern compiler such as Code::Blocks...
Forum: C++ 7 Days Ago
Replies: 19
Views: 468
Posted By Ancient Dragon
The ordering is not done in the code snipped I posted, but in the sort function you posted. On line 48 of post #9, change > to <

>>When I changed < to > it prints out nothing.
Of course it will...
Forum: C++ 7 Days Ago
Replies: 19
Views: 468
Posted By Ancient Dragon
The program in post #9 works ok for me after making one small change. You are calling the sort function twice, and not displaying the results after sort is done.

cout << "Here is the sorted...
Forum: C++ 8 Days Ago
Replies: 19
Views: 468
Posted By Ancient Dragon
Functions know nothing about variables declared in other functions. If you want selectionSort() to use variables in another function then those variables have to be passed to selectionSort() as...
Forum: C++ 9 Days Ago
Replies: 7
Views: 310
Posted By Ancient Dragon
use std::string's c_str() method
Forum: C++ 9 Days Ago
Replies: 7
Views: 310
Posted By Ancient Dragon
the replace() function may make your code smaller, but efficiency is probably the same. Somebody has to loop through the string one character at a time. Whether you do it or replace() doesn't...
Forum: C++ 9 Days Ago
Replies: 6
Views: 274
Posted By Ancient Dragon
The Seek() (http://msdn.microsoft.com/en-us/library/system.io.filestream.seek.aspx)method returns a long long which is the length of the file
Forum: C++ 9 Days Ago
Replies: 7
Views: 310
Posted By Ancient Dragon
Here is another way to do it.

string space2underscore(string text)
{
for(int i = 0; i < text.length(); i++)
{
if( isspace(text[i]) )
text[i] = '_';
}
...
Forum: C++ 9 Days Ago
Replies: 10
Views: 410
Posted By Ancient Dragon
Now is when you need to learn how to use your compiler's debugger so that you can single-step through the program one line at a time. I already told you why your program doesn't work. The problem...
Forum: C++ 9 Days Ago
Replies: 6
Views: 274
Posted By Ancient Dragon
The general way to get the file size is to seek to the end of the file then get the current file position. I don't know how you would do that with CLR/C++ (managed code), but I'm certain if you read...
Forum: C++ 9 Days Ago
Replies: 10
Views: 410
Posted By Ancient Dragon
The program doesn't work because the Clear() method destroys the value of MaxBytes by setting it to 0, which makes that Pack() return false when checking if size > MaxBytes.

void...
Forum: C++ 9 Days Ago
Replies: 10
Views: 410
Posted By Ancient Dragon
You don't have to read the data back into a account class. You can do anything you want with the data, such as read it back into individual char arrays if you want to. The data file is not tied to...
Forum: C++ 9 Days Ago
Replies: 10
Views: 410
Posted By Ancient Dragon
There is no need for the pack() functionality. The account class is already packed (fixed-length). Just write the account object to a binary file.

void write(Account& obj)
{
ofstream...
Forum: C++ 10 Days Ago
Replies: 9
Views: 459
Posted By Ancient Dragon
I think everyone has already answered that question. First, create function prototypes for the functions your c++ program needs to call, surround them with extern "C", then put the DLL somewhere the...
Forum: C++ 11 Days Ago
Replies: 9
Views: 459
Posted By Ancient Dragon
>>I'm speaking most particularly of GUI class frameworks.
There are no GUI frameworks in standard c++. You must be thinking of some 3d party libraries, such as wxWidgets, MFC, OpenGL, DirectX,...
Forum: C++ 11 Days Ago
Replies: 9
Views: 459
Posted By Ancient Dragon
you have to declare them extern "C".

#ifdef __cplusplus
extern "C" {
#endif
// C function prototypes here
#ifdef __cplusplus
}
#endif
Forum: C++ 12 Days Ago
Replies: 8
Views: 360
Posted By Ancient Dragon
Tadaaa -- when compiled for UNICODE those two are identical.
Forum: C++ 13 Days Ago
Replies: 14
Views: 322
Posted By Ancient Dragon
It is NOT necessary to compile a program using an IDE. You can use command-line compiles with or without a makefile if you want to. What compiler was you using and how was you compiling the program...
Forum: C++ 13 Days Ago
Replies: 14
Views: 322
Posted By Ancient Dragon
The damed program works fine as it is, its not necessary to change the data type of age, nor would it even be desireable. You're trying to make a binary file act like a text file -- it doesn't. You...
Forum: C++ 13 Days Ago
Replies: 14
Views: 322
Posted By Ancient Dragon
Add this to the bottom of that program to verify that it worked (works ok for me on Windows 7 using VC++ 2008 Express compiler)

ifstream in("myFile.dat", ios::binary);
int k = 0;
if(...
Forum: C++ 13 Days Ago
Replies: 8
Views: 360
Posted By Ancient Dragon
You have to include wininet.h and shlobj.h, then compile the program for UNICODE
Forum: C++ 14 Days Ago
Replies: 5
Views: 303
Posted By Ancient Dragon
1) you can not compare a single character such as aData with a string such as "Exit".

2) 'Exit' must be surrounded with double quotes, such as "Exit".
Forum: C++ 14 Days Ago
Replies: 2
Views: 160
Posted By Ancient Dragon
replace all 7 loops with something a function

void GetMartks(std::string prompt, float& mark)
{
cout << prompt << '\n';
cin >> mark;
mark = decimal(mark);
}
Forum: C++ 14 Days Ago
Replies: 3
Views: 186
Posted By Ancient Dragon
Your text book should be able to answer that question. Yes, programs can have an unlimited number of functions which can be called from other functions such as main(). What your program is missing...
Forum: C++ 14 Days Ago
Replies: 3
Views: 186
Posted By Ancient Dragon
>>Can someone please help me with this?
Can we do what to help you ? Post the code you have written, compiler's error messages, and ask questions. We are not going to write the program for you.
Forum: C++ 16 Days Ago
Replies: 22
Views: 493
Posted By Ancient Dragon
Just check for end-of-string null terminator
for(int i = 0; string[i] != '\0'; i++)
Forum: C++ 16 Days Ago
Replies: 4
Views: 209
Posted By Ancient Dragon
Post code or a link to the code.
Forum: C++ 16 Days Ago
Replies: 22
Views: 493
Posted By Ancient Dragon
>>The you can just concat title with first name.

That was my objection. Those two can not be joined.
Forum: C++ 16 Days Ago
Replies: 22
Views: 493
Posted By Ancient Dragon
Wrong answer. Those strings don't have enough space allocated to concatenate them (see original post). Each of those strings need to be copied into some buffer that is large enough to hold all the...
Forum: C++ 17 Days Ago
Replies: 22
Views: 493
Posted By Ancient Dragon
You don't need to pass the length of each of those strings. The concat function can easily find the lengths itself.

Here is how to make concat() return the string

string concat(const char*...
Forum: C++ 17 Days Ago
Replies: 2
Views: 243
Posted By Ancient Dragon
Are you looking for c++ code or pseudocode?

declare three integers, one for age, one for sum of ages, and third for number of ages entered.

in a loop
prompt for age
update sum
...
Forum: C++ 17 Days Ago
Replies: 4
Solved: Char* input
Views: 233
Posted By Ancient Dragon
getline() will permit you to enter spaces in the string. If you don't want the spaces then use >> operator cin >> this->name;, but the problem with that is the >> operator will allow you to enter...
Showing results 1 to 40 of 1000

 


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

©2003 - 2009 DaniWeb® LLC