624 Posted Topics

Member Avatar for skatamatic

For an assignment I must implement an operator -= to remove points from a canvas (that have been plotted broken line graph style). Here's the part where the problem is occuring. It certainly removes points, just not the right ones seemingly and not all of them. It doesn't make much …

Member Avatar for skatamatic
0
337
Member Avatar for andrewama

I would use structs to represent the cards, rather than just arbitrary arrays. Here's a blackjack game I wrote a few years ago for school that might give you the right idea. [code=cplusplus] /************************************************************************* Project: Lab 4 Files: main.cpp Date: March. 24, 2008 Author: Kyle Wesley Class: 2D Instructor: Cindy …

Member Avatar for andrewama
0
2K
Member Avatar for NinjaLink

You forgot to include the string header: #include <string> without this, the compiler doesn't know how to handle string datatypes.

Member Avatar for VernonDozier
0
109
Member Avatar for jammy's
Member Avatar for slanker70

I don't really see the point in initializing this variable in the switch. Could it not be initialized at the start? It's generally considered bad practice to do things like this.

Member Avatar for Salem
0
100
Member Avatar for n8thatsme

If you really want to keep it all on one line like that, something like this is generally a sure fire way to make this sorta thing work: [code=cplusplus] cout << article[(static_cast<int>(seed_val) % MAX_ARTICLES)]; [/code]

Member Avatar for n8thatsme
0
169
Member Avatar for denner

I'm no linux guru, but i think you could redirect the output of ls to a file within a system() call. I forget how to do this in *nix but in windows it would be something like: dir > file.txt Then this file can be opened for input and parsed. …

Member Avatar for stilllearning
0
675
Member Avatar for mypopope

Most generaly, link errors are caused by a mismatch in a function/method declaration and the actual implementation. Hence being unable to link the two (and possibly more in the case of overloading). For example, this would result in a link error: [code=cplusplus] void Foo(int, int); int main() { Foo(10, 10); …

Member Avatar for stilllearning
0
120
Member Avatar for shopnobhumi

In this forum you need to show effort for people to help you. Take a stab at it and post what you're having troubles with.

Member Avatar for shopnobhumi
0
99
Member Avatar for Razzar

Hmmm it's not very clear what the problem actually is...but I think the reason why its looping that text is because you forgot to clear the cin stream. Use this line: [code=cplusplus] cin.clear(); cin.ignore(cin.rdbuf()->in_avail()); [/code] Put that before every 'cin' line you use to clear excess characters from being reaad …

Member Avatar for skatamatic
0
124
Member Avatar for blackryu21

[QUOTE=blackryu21;712450]I have to match up airlines for flights in c++, but for certain matchups, the value would be equal to x. I need help to do it. Here's the code I have so far: [code] #include <iostream> using namespace std; int main() { int nROWS = 4; int nCOLUMNS = …

Member Avatar for stilllearning
0
136
Member Avatar for skvikas

Hmmm i think your first (nested) delete loop should not have the [] operator after the delete line. The way I understand it, there at [i][j] the thing being deleted is no longer an array. So: delete _3DarrayOfSet[i][j]; should suffice. If I'm wrong, and _3DarraOfSet[i][j] is in fact a pointer …

Member Avatar for skvikas
0
149
Member Avatar for skatamatic

I've recently bought a linksys wireless n router, then it failed completely (i assumed a power outage fried its eeprom?) so I bought another (same one). This one works fine, except it randomly drops my wireless connection about once per day for about 15 minutes. What would cause this?! I …

Member Avatar for zeroth
0
84
Member Avatar for nosa2008

Hmmm. I don't think that the ^ operator works in c++. I could be wrong =\ , but I think you must use the POW func in the cmath header. I think that ^ is some sort of bitwise XOR or XNOR or something of the sort.

Member Avatar for Freaky_Chris
0
104
Member Avatar for Liszt

Check out[URL="http://www.daniweb.com/forums/thread150836.html"] this related thread[/URL]

Member Avatar for skatamatic
0
81
Member Avatar for toucan
Member Avatar for skatamatic
0
111
Member Avatar for faisal_pedaw

A struct is a simple user-defined data type that can contain other (user defined or standard) datatypes. For example, if you wanted to create a struct of golfer names and scores: [code=cplusplus] struct SGolfer { //struct members go here char * _szName; int _iScore; }; [/code] This can now be …

Member Avatar for skatamatic
0
128
Member Avatar for kavithabhaskar

You're misusing while loops, use a for loop instead. And use strlen(szString) to calculate the length of a null terminated c style string. ie: [code=cplusplus] char const * kavi("my shiny sword"); cout<<kavi<<endl; cout<<"now reversing the word"<<endl; cout<<"Length is "<<strlen(kavi) <<endl; for(int j=strlen(kavi); j>=0;j--) cout<<kavi[j]; [/code] Strlen will return an int …

Member Avatar for skatamatic
0
6K
Member Avatar for elsa87

Hah. There's whole courses on stuff like this. I'd sugguest you take one if you really plan on writing this. Or pull your hair out!

Member Avatar for ArkM
0
112
Member Avatar for minigweek

I think you need to isolate your issue a little better, and post as little code as possible. That's too much code! Step through/into the code (F10 and F11 in VS05) and keep an eye on the values of your locals to find where it actually fails.

Member Avatar for sidatra79
0
641
Member Avatar for Se7Olutionyg

Generally a link error occurs when the linker cannot resolve a function to its declaration. The solution to this was already posted.

Member Avatar for skatamatic
0
91
Member Avatar for LordoftheFly

Make a function like this (with iostream included and the std namespace): [code=cplusplus] ostream & Flush (ostream & myStream) { myStream.clear(); myStream.ignore(myStream.rdbuf()->in_avail()); return myStream; } [/code] Then call it for whatever stream you want to clear, and it supports chaining. ie Flush(cin) >> iInput;

Member Avatar for LordoftheFly
1
308
Member Avatar for alleycot

My price is $250.00, which is much cheaper than any software companies would charge, even though that program would take about 2 minutes to write.

Member Avatar for Ancient Dragon
1
266
Member Avatar for sandya_vish

What do you need help with? Are you expecting someone to write this code for you?

Member Avatar for skatamatic
0
93
Member Avatar for Tr1ckst3rNcag3d

I would sugguest you use linked lists for this sort of thing (or a binary tree). But if that's outside your knowledge, you could use a horribly inefficient check loop: [code=cplusplus] int const MAX = 10; int main() { int iNum[MAX], iRand(0); bool bFlag(false); for (int i(0); i < MAX; …

Member Avatar for Tr1ckst3rNcag3d
0
96
Member Avatar for CodyOebel

Well remotely i'm not sure if that will work...but if you know the process name or the PID, you can do a system call from c++ or just run a batch containing: taskkill /f /PID [PID] or taskkill /f /IM [process name] I'm not sure of how to obtain the …

Member Avatar for Th3_uN1Qu3
0
148
Member Avatar for koushal.vv

use this snippet in your code: [code=cplusplus] #include <crtdbg.h> int main() { _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); return 0; } [/code] This won't actually detect where the leak is occuring, but can give you a good idea. For example, if you are allocating 20 bytes of memory for a certain array, and …

Member Avatar for Salem
0
158
Member Avatar for Aamp88

I hate it when people offer me money for my homework. If it doesn't make sense to you, perhaps you've chosen the wrong field? I mean, how are you going to explain to your boss that you have no idea what he's talking about your first day of work? Maybe …

Member Avatar for William Hemsworth
0
141
Member Avatar for acoxia

Is that how the binomials are saved to the file? If so, then you will need load it into a string, then parse the string. If you aren't looking for robustness and user usability, you could just say the 4th and 9th letter in the string are to be used …

Member Avatar for acoxia
0
151
Member Avatar for skatamatic

Hi, I'm not sure I understand my teacher properly, but he wants me to use the CCTOR of class CPt in the CCTOR of class CCanvas to fill a dynamically allocated array. I'm at a loss of how to call it...maybe a little code will help this make more sense: …

Member Avatar for skatamatic
0
176
Member Avatar for skatamatic

I'm not too sure why I'm getting memory leaks...hopefully someone here is wiser than me, and can help me find it :P . [code=cplusplus] #include "Canvas.h" CDrawer CCanvas::gCanvas(RGB(0,0,0), 1); int const GREEN(20000),BLUE(50), RED(200), THICK(3); CCanvas::CCanvas(void): _iSize(0), _cptPoints(0) { } CCanvas::CCanvas(CCanvas const & tmpCanvas): _iSize(tmpCanvas._iSize) { if (_iSize > 0) { …

Member Avatar for ivailosp
0
319
Member Avatar for jeevsmyd

I don't think a class is neccessary here. It's alot of overhead for doing something very simple. Instead, just use an array representing the right values, and a single buffer for value entry and comparison. To check times, use this: [code=cplusplus] #include <ctime> #include <iostream> int main() { int iVal(0); …

Member Avatar for Sci@phy
0
656
Member Avatar for RayvenHawk

There's a few solutions to that 'problem'. I usually try and keep the clutter out of main by putting all the meat and bones of main() into functions and only using main to call them, and potentially have a loop (which would return you to the first menu for example). …

Member Avatar for RayvenHawk
0
205
Member Avatar for jadedman

I'd send you the drawer lib my teacher wrote for us, but I'll have to check with him first to make sure it's alright.

Member Avatar for jadedman
0
88
Member Avatar for tones1986

Hmmmm, I'm not to sure if your teacher is forcing a particular method, but mod is useful for this kind of thing: [code=cplusplus] int iNum(7); bool bPrime(false); //since even primes have a factor of 1 //and themself, start at 2 and stop 1 less than the number for (int i …

Member Avatar for skatamatic
0
429
Member Avatar for preet4fun

There is no way to do that without the use of arrays, or some array based library algorithm. What form of string are you using? Because I think in the string.h library there is some commands for doing this kind of thing - although I'm sure you haven't learned about …

Member Avatar for Salem
0
208
Member Avatar for Alex Edwards

Unfortunately, C++ won't be able to write an operating system for you. You'll need to dig deeper into the dreaded Assembly language, and then even deeper than that into the god awful machine code. If you really want to experiment with operating systems/memory/registers etc... I would sugguest you build an …

Member Avatar for skatamatic
0
169
Member Avatar for acoxia

if your using the iostream library, strlen(szString) + 1 //+1 for the null terminator will work just dandy.

Member Avatar for acoxia
0
115
Member Avatar for bbhe

I think you are trying to create an html file, which does support colored text. To do this, you will need a very basic knowledge of both the fstream library and html coding. If you do not have this knowledge then it will be very difficult to help you.

Member Avatar for bbhe
0
153
Member Avatar for OnIIcE

If you have the actual sound data in some sort of array/list and the frequency, then just create a for loop to iterate each element - and draw pixel by pixel the data to the screen (with some sort of drawer lib). This will take a bit of math (to …

Member Avatar for skatamatic
0
222
Member Avatar for kux

[QUOTE=kux;696646]Compile this code with MSVC2005 [CODE] unsigned short x = 20; unsigned short y = 20; for ( unsigned long i = 0; i < x * y ; i++ ) { cout<<i<<endl; } [/CODE] and u get warning C4018: '<' : signed/unsigned mismatch why? i mean, it all runs …

Member Avatar for kux
0
133
Member Avatar for defychaos

[code]for(case=1; case < 9999; case++;) { t1 = Input_Time(Time&, int) t2 = Input_Time() totalSeconds = Time_To_Seconds(Time t1, Time t2);[/code] these lines should be replaced with: [code] for(int i=1; i < 9999; i++) { Input_Time(t1) t2 = Input_Time() totalSeconds = Time_To_Seconds(t1, t2); [/code] this line (18): [code] void Input_Time(Time&, int, int, …

Member Avatar for skatamatic
0
120
Member Avatar for volscolts16

Well I don't have time to go through all that code, but assertion errors are usually caused by attempting to delete a value that doesn't exist. It doesn't seem like your code uses any DMA though, so it could be internal (included libraries). Try stepping through/into your program (f10/f11) to …

Member Avatar for skatamatic
0
105
Member Avatar for Natrax

I would not recommend using the microsoft website for any sort of help. It's pretty bad in general. This is one of the reasons why; they seem to have alot of strange and/or outdate (C language) snippets posted.

Member Avatar for Natrax
0
76
Member Avatar for pads
Member Avatar for skatamatic

As a part of an assignment I am to construct a copy constructor for a bitmap loader/manipulator class. 2 of the things that must be copied are struct headers (containing a bunch of useless bitmap information, with a tiny bit of useful stuff). Image Headerfile: [CODE=cplusplus]#pragma once #include "Drawer.h" #include …

Member Avatar for skatamatic
0
248
Member Avatar for skatamatic

Ok, so I'm trying to prove to my teacher that Div and Mod isn't always the best way to solve things. So i created this tiny program, held entirely in main.cpp : [CODE=cplusplus] //Project: Mod_Efficiency //Author : Kyle Wesley //Descrip: This was made to prove that mod/div operations are often …

Member Avatar for skatamatic
0
3K
Member Avatar for skatamatic

I don't know what's going on here...but I always seem to get 2 leaks of 40bytes each consisting of FF FF FF FF.... Even with all the code commented out, I still seem to get these leaks. I'm running Visual Studio on Vista SP1, so perhaps a combatibility issue? Or …

Member Avatar for skatamatic
0
125
Member Avatar for skatamatic

I recently bought a new wireless router (a Linksys 802.11n). The power failed and my brother had unplugged it from the surge protector and into the wall >.< . Well a day later it was acting haywire, it was very difficult to connect to wirelessly and would disconnect after about …

Member Avatar for skatamatic
0
100
Member Avatar for earpe70

Should work. If loading the XP cd on boot doesn't work, then format (after a backup of course) the drive and try again.

Member Avatar for Talonis
0
101

The End.