202 Posted Topics

Member Avatar for seogoat

Try [URL="http://www.paulhorst.com/c241/stacks.htm"]http://www.paulhorst.com/c241/stacks.htm[/URL]. Let me know if that works.

Member Avatar for dmanw100
0
105
Member Avatar for dmanw100

I am trying to use sprites, which I made in the form of bitmaps, in my program. Is there a library that will allow me to easily display them? I tried to use OpenGL but my computer will not allow it to initialize. I would simply like to display bitmaps …

Member Avatar for dmanw100
0
102
Member Avatar for transplantedNYr

If you change the numbers[] array so the first element stored is the length of the array, then you can eliminate the second variable and simply keep passing the array to the function.

Member Avatar for transplantedNYr
0
97
Member Avatar for Ellisande

strcmp compares the actual values of the character array (string) and the string literal you supply. So you are checking to see if argv has either the value [y][e][s][\n][] or [n][o][\n][][]. If the letters are capitalized, then the binary values for the letters are not the same, meaning that the …

Member Avatar for Narue
0
97
Member Avatar for freelancelote
Member Avatar for freelancelote
0
126
Member Avatar for EBaller55
Member Avatar for justinlake888

Global variables are variables that are declared outside a function, meaning that they can be accessed anywhere in the program by any function. Any variable declared outside of int main() is a global variable. Using global variables is not good programming technique, although it can be done.

Member Avatar for dmanw100
0
128
Member Avatar for BINDERJ2

You will probably want to store the name as a string, the dates in one array, and the heights in another. Make sure the jump distance array is double or float. Then sort height list in ascending order, make sure that when you move a value in that array that …

Member Avatar for Ancient Dragon
0
304
Member Avatar for chern4ever

If you want to use modulo without floating points try (int)myFloat % (int)myOtherFloat

Member Avatar for chern4ever
0
329
Member Avatar for masterjiraya
Member Avatar for masterjiraya
0
151
Member Avatar for dmanw100

I followed Ancient Dragon's advice and used vectors to store roughly 1000 objects in a program I have written. Unfortunately, the vector library is not one I am familiar with. I read through the information at [URL="http://www.cppreference.com/cppvector/index.html"]http://www.cppreference.com/cppvector/index.html[/URL]. It seems getting a reference to each element of the vector is the …

Member Avatar for dmanw100
0
97
Member Avatar for shirishbhosale
Member Avatar for dmanw100

Can anyone spot the error in my code? The program will enter the last while loop but continue in an infinite loop... I figured fresh eyes may help spot the flaw! [CODE] int xlist[1500], ylist[1500], counter = 0, tempx, tempy, tempcounter; bool assign = false; while(counter < 1500) { xlist[counter] …

Member Avatar for dmanw100
0
109
Member Avatar for dmanw100

I have a program that has a custom class that I would like to create many of and access them like an array. Example: [CODE]#include <iostream> using namespace std; class Thing { public: Thing(int value) { a = value; } int doStuff(int diffValue) { a = diffValue + a; } …

Member Avatar for Agni
0
119
Member Avatar for Gerbilkit
Member Avatar for stema08
0
243
Member Avatar for dmanw100

Is there any way to clear the screen in a console app? I noticed that System does not even appear to have a system call similar to the system("COMMAND"); of C++. Any ideas?

Member Avatar for jwenting
0
100
Member Avatar for Tootlol

I think its because you never increase the step integer so karel never stops the karel.move(); and karel.putBeeper(); routine. If the move(); method doesnt increase the step counter, then karel will never exit. Put something like step = step + 1; in the while loop to see if that fixes …

Member Avatar for dmanw100
0
126
Member Avatar for the universe

I think you mean this: [CODE]#include <iostream> #include <ctime> using namespace std; int main() { int array[100], counter = 0; srand((unsigned)time(0)); while(counter < 100) { array[counter] = rand(); counter++; } return 0; }[/CODE] That's a simple solution if I understand your problem...

Member Avatar for VernonDozier
0
147
Member Avatar for zaaweel

[CODE]#include <iostream> using namespace std; int main () { int age; cout <<"How old are you?:"; cin >> age; if(age > 12 && age < 19) { cout << " You're an teenager "; } else if(age > 18) { cout << " You're pretty old "; } else { …

Member Avatar for dmanw100
0
80
Member Avatar for Mehwish Shaikh
Member Avatar for bamabambhole01

[CODE]#include <fstream> #include <iostream> using namespace std; int main() { int a = 1; fstream yourFile; yourFile.open("log.txt"); yourFile >> a; yourFile.close(); return 0; }[/CODE] Something like that. Maybe the ">>" needs to be "<<".

Member Avatar for dmanw100
0
120
Member Avatar for tyserman5674

Two tips: first, you have commented that there is an end to a while loop where the three temps are entered, but there is no loop and I have had problems using fstream. You can declare it as "fstream myFileInput("input.txt"); without the ios::out.

Member Avatar for raul15791
0
161
Member Avatar for Jennifer84

Perhaps opening and closing the string for the box causes a 'return' to be placed on it each time. Then, when you open the string again, the stream starts at the end of the string, which would cause it to be on the second line, then third, etc. Try accessing …

Member Avatar for Jennifer84
0
80
Member Avatar for chern4ever
Member Avatar for Nick Evan
0
93
Member Avatar for dmanw100

Is there a reliable, cross-platform way to pause a program for a set amount of time? The getch() function will wait for user input, but I would like to be able to pause for say 3 seconds. If a for loop is used like so: [CODE]#include <iostream> using namespace std; …

Member Avatar for Ancient Dragon
0
129
Member Avatar for iamloco

It wouldn't compile on Dev without using <iostream> instead of <iostream.h>... otherwise. The other problem is that you're declaring functions that you never call. When you declare double previous, current and unpaid in main(), you are creating variables with those names, not calling the functions. Try this: [CODE]#include <iostream> #include …

Member Avatar for iamloco
0
86
Member Avatar for dmanw100

I was wondering if anyone was familiar with reading data from a file into your program. I tried using the file stream the same way cout is used but it doesnt seem to work properly. Would the getline(); function work? If so, how would that be implemented? [CODE]#include <iostream> #include …

Member Avatar for dmanw100
0
137
Member Avatar for shipeshipaca

Try Data Structures and the Standard Template Library by Collins, C++ GUI Programming with QT 4, and perhaps C++ for Game Programmers. Those three books helped me a lot.

Member Avatar for Alex Edwards
0
284
Member Avatar for dmanw100

I'm having trouble getting fstream to function properly. I cannot open a text file while using any of the available parameters. My program calls mainprog() and functions correctly if I compile it as follows: [CODE]fstream openfile; openfile("my_file.txt"); if(openfile.fail()) { cout<<"Error opening file."; } else { mainprog(); }[/CODE] But if I …

Member Avatar for l4z3r
0
159
Member Avatar for ankit7

[QUOTE=ankit7;677042]hiii, thanks for the reply but i m getting some errors in the program after running the program ........the error are like.... 1. unable to open include file 'windows.h ' 2. undefined symbol 'HWND'. 3. statement missing ; 4. function 'ShowWindow' should have a proto type. 5. undefined symbol 'SW_SHOWMAXIMIZED'. …

Member Avatar for dmanw100
0
136
Member Avatar for dmanw100
Member Avatar for kux
0
154
Member Avatar for Evan M

I'm just dabbling in the communications section but I wondered what you meant by framing the message with "\n" to reassemble it. Do you mean sending something like an array of characters with a "\n" placed in the last entry and then piecing all incoming data together until a "\n" …

Member Avatar for dmanw100
0
586
Member Avatar for dmanw100

I recently completed a small console app that accepts input from the user and places it in a floating point array, which was implemented through a for loop. I have not spent much time studying error handling and was wondering if anyone could refer me to a useful error-handling tutorial. …

Member Avatar for dmanw100
0
102
Member Avatar for rizahbeng

Start by accepting the weight in ounces and converting it to grams. Then divide the weight in grams by the number of grams/ton to get the weight in metric tons. Then divide a metric ton by your weight in grams and you have the number of boxes needed.

Member Avatar for William Hemsworth
0
142
Member Avatar for scream2ice

I'm trying to convert from char* to int. Is there an easy way to do that?

Member Avatar for invisal
0
331
Member Avatar for dmanw100

Is there an easy way to convert from Char* to int? I have tried converting as such: [CODE]char* value_a; int* temp = value_a; int final = temp;[/CODE] The compiler is returning an error so I know something is wrong but why can't I convert this way? Any suggestions as to …

Member Avatar for ArkM
0
181
Member Avatar for dmanw100

I have a problem that seems like it should be easy but so far has been fairly difficult to find documentation on... I want to be able to pass parameters to a program in the command line in the same manner as the built in functions (ex. the "/r" in …

Member Avatar for Prabakar
0
122
Member Avatar for zyaday

The easy fix is putting in your XP CD, going to the recovery console, and running FIXBOOT and FIXMBR. These should replace the NTLDR and get your machine to boot.

Member Avatar for zyaday
0
128
Member Avatar for dmanw100

I am almost done with a project and now I would like to code an installer for it. I know there are many free solutions to make installer packages online, but I would enjoy learning how to make one from the ground up for the expirience if nothing else. What …

Member Avatar for dmanw100
0
151
Member Avatar for manzoor

Make two variables, one for min and one for max. Assign them to the first two numbers in your sequence. Compare each new element that you encounter with the min and the max. If it is larger than the max or smaller than the min, assign it. When you have …

Member Avatar for manzoor
0
99
Member Avatar for dmanw100

I was wondering if anyone could recommend a powerful library for communicating with USB jump drives? My attempts to locate a solution on Google have not provided much in terms of usefulness. I would simply like to read and write to the drive, perhaps even find the size of the …

Member Avatar for dmanw100
0
167
Member Avatar for Squeeker

Can't a literal constant also be defined as const float pi = 3.14159265358979323?

Member Avatar for Squeeker
0
185
Member Avatar for dmanw100

I was wondering if anyone could help me with what should be a simple PHP script. I want to write a text file, inputing different strings to different lines using some predefined lines and some input from a text box, then save it with another extension (such as .ini). Here's …

Member Avatar for nav33n
0
106
Member Avatar for rock9449

You need to use fstream... here is a good reference [url]http://www.cplusplus.com/reference/iostream/fstream/[/url]

Member Avatar for dmanw100
0
101
Member Avatar for zidaneqrro
Member Avatar for William Hemsworth
0
142
Member Avatar for Motvel

Place your points in an array and use a loop based on the number of points to calculate the distances, checking each result with the last to see if it is less. If so, it should become the new "shortest distance"

Member Avatar for dmanw100
0
123
Member Avatar for kiwihaha

Maybe the best way to do this would be to error check after each input, then move on. while(input1==false) { cin>>input1 } while(input2==false) { ...

Member Avatar for dmanw100
0
118
Member Avatar for n3XusSLO

The error makes it sound like you're trying to redefine the function in your main file. You need to declare an instance of a class to use the functions in it.

Member Avatar for n3XusSLO
0
278
Member Avatar for picass0

Open the file with fstream, search for the line with the id you wish to edit, then write to that line. A nice reference can be found at [url]http://www.cplusplus.com/reference/iostream/fstream/[/url]

Member Avatar for dmanw100
0
116
Member Avatar for Black Magic

Try using a .bin file (binary)... this will make it nearly impossible for the average user to access your password database.

Member Avatar for Black Magic
0
78

The End.