|
Your ret is set to false and the return value from the file open is returned but never used in your main function.
|
|
|
|
|
Thank y'all! I've got it solved with the help of DavidCrow. Actually, ::GetCurrentDirectory() may return inconsistent paths.
|
|
|
|
|
I am making a desktop development.But there is a problem that I can't solve till now.In the development I have to add some command buttons to the listbox.And the first item is different from others.It is like a header with text.So how can I do it.Thanks.
|
|
|
|
|
Just try with the subclassing, You have subclass a control to get the rid, try this example Control Subclassing[^]
Величие не Бога может быть недооценена.
|
|
|
|
|
Thanks your help.Now I have solved the problem.
|
|
|
|
|
Hi all--
I've got a program where you click and add points to make a polygon using a linked list, and now I want it where by pressing a button it will take the points on the polygon and make it a cubic b spline curve. However I have no experience with the b spline curves and am having trouble with were to start. So I was wondering if you would be able to help me with the pseudo code for this, using C so that I can better understand what I'm trying to do. Here is what I have come up with so far (which isn't much unfortunately):
Create a drawCurve function that traverses the linked list in order.
Take the first four points to draw the spline curve, then the next one over each time.
[insert how to do the math here (of which I am confused about)]
Use a state machine to implement. So pressing a button of my choice will change between the drawing polygon state and the draw curve state.
Thank you very much for your help.
|
|
|
|
|
Now, where's that 'homework' tag?
L u n a t i c F r i n g e
|
|
|
|
|
I'm not asking you to do it for me, I'm just trying to figure out where to start
|
|
|
|
|
Carl De Boor's book "A practical guide to splines" has pseudo code for what you want.
|
|
|
|
|
|
Buddys,
How to create database and manipulations on that databse by using sqlite databse. plz provide me solution.
iam trying to create with add CppSQLite3.h in my code, but its not working, getting some sqlite exception.
|
|
|
|
|
kirancgi wrote: plz provide me solution.
This is not possible in a forum; try reading some of the articles on databases.
kirancgi wrote: its not working, getting some sqlite exception.
We cannot guess what this could mean. Show your code where the exception occurs, and include the exact wording of the exception. Only then can anyone try and help to diagnose the problem.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Richard MacCutchan wrote: Only then can anyone try and help to diagnose the problem.
Well, you're not much of a mindreader now are you?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
DavidCrow wrote: Well, you're not much of a mindreader now are you?
True, but at my age some talents start to fade.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
At 27, I've almost lost all the mind reading capabilities. So, you're out of question!
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Truth to tell I lost mine when I was half your age.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
I knew you were going to say that!
Ali
|
|
|
|
|
Alison P wrote: I knew you were going to say that!
Wow, spooky!
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
You should start with drugz then.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
I am currently working on a project for a class, and what I need to do is make a .txt file with a letter on the first line and two two-digit numbers on the second line, and have it write to another text file what the ASCII code for the letter and add and multiply the two numbers.
I've been able to get the code to compile, but it prints out strange numbers instead of what the answers should be. I've been told to initialize my variables, but when I set them to 0, thats all the program reads. So I get a file like, the ASCII is 0, and 0 + 0 = 0, and the like.
Here is the code. Please tell me where I am messing up!
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream inFile;
ofstream outFile;
char letter1;
double num1;
double num2;
inFile.open("input.txt");
outFile.open("answers.txt");
inFile >> letter1 >> num1 >> num2;
outFile << "The ASCII value of your character: " << letter1<< " is " << static_cast<int>(letter1) <
|
|
|
|
|
why are num1 and num2 declared as double ? I would try 'int' (looking at your input file example)..
int num1 = 0;
int num2 = 0;
what is that static_cast doing ? try
<< (int)letter1 << endl;
ok, thats old school these days, but Im an old f@rt, so it doesnt matter ... in the next two lines, bracket the operations so you get
<< (num1 + num2) << endl;
<< (num1 * num2) << endl;
the 'system(pause)' isnt doing much - you can step through your prog using F10 for example (if you're using MSVC) and look at the variable contents - or, sprinkle some 'cout' statments around to display things on the console/stdout instead of just to the file
ie
cout << "The Value of num1 is : " << num1 << endl;
|
|
|
|
|
I have just tried this as it stands changing only the static_cast(letter1) to (int)letter1 , and the results are correct. Looking at your results I can only assume that the program cannot find your input file, but as you do no error checking there is no notification of that condition. Check the return value of the open call to see that it is not NULL.
I would also agree with Garth's suggestion that you use int rather than double for your numeric values.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Thanks a bunch for the help guys! For some reason my class is telling me that static_cast<int>(letter1) works fine, but I can't get it to work at all. (int)letter1 worked amazingly well. The system("PAUSE"); was only in there due to my debugging, so that got removed before the final submitting. I did switch from double to int, but was using double before because, well, I still haven't fully fleshed out the differences in int, double, and float. I found another problem I had was I put the input.txt file in as a source file, not a resource file, so that probably had a chunk to do with it also. Anyways. They are hitting us hard with this term in programming, and since it's all done online, I really didn't have anyone to turn to. Thanks again for bailing me out!
|
|
|
|
|
Glad you figured it out. Just a couple of things extra:
1. See here[^] for documentation on static_cast .
2. The different numeric types are:
2.1 int for holding values in integer format (i.e. without any fractional part) e.g. 1, 3, 212, 134788 etc.
2.2 float and double for holding values with a fractional (or decimal) part e.g. 3.14, 0.000497 etc.
Generally speaking it is best to use integer types unless you must deal with decimals, as they lose precision owing to the manner in which they are stored in computer words.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|