466 Posted Topics

Member Avatar for Nirliq

How are you currently trying to change it? And, what exactly goes wrong when you [i]do[/i] try to change it?

Member Avatar for Nirliq
0
134
Member Avatar for mikecolistro

I tend not to use predefined [icode]MAX_NUM[/icode] or [icode]MIN_NUM[/icode] values when finding the min and max of arrays. Instead, I tend to initialise the min or max to the first value of the array and then loop over the remainder of the array. So, in your case a [icode]findMin()[/icode] function …

Member Avatar for ravenous
0
168
Member Avatar for MasterGberry

[QUOTE=MasterGberry;1446991]Because it is a long int value, and is not in hex value? I am not sure if it will or will not work. Thats why I am trying to get opinions on it. Or can C++ automatically compare a hex value to its long int equivalent?[/QUOTE] I don't think …

Member Avatar for MasterGberry
0
1K
Member Avatar for rcmango

I may have mis-understood, but you could declare your class as [code] template <typename T> // Replacing template< int T > class BruteForce { private: int currentItem, nextItem; std::queue<T> q; public: void MakeQueue(); void GetPercepts(); int reflexAgent (int,int); void DisplayInfo(); }; [/code] This should allow to to create a [icode]BruteForce[/icode] …

Member Avatar for rcmango
0
530
Member Avatar for lochnessmonster

It's easier if you put the types of the variables too. From what you have above, I think that you have this: [code] int value = 25; // A variable that you implied was equal to 25 int *beth; // A pointer to an integer int *ted = &value; // …

Member Avatar for ravenous
0
115
Member Avatar for iamthesgt

You can use the STL [icode]std::transform()[/icode] function to convert the whole line to lower case using a single line of code: [code] #include <iostream> #include <string> #include <algorithm> // std::transform is in here int main() { /* Make a string, this is a tough one, with lots of things to …

Member Avatar for mrnutty
0
218
Member Avatar for MasterGberry

I don't know if this exact same thing exists, but you could do something similar using the [icode]std::map.find[/icode] member function. [code] std::map< char, int >::iterator it = myMap.find(myKey); if(it != std::map::end) value = *it; [/code]

Member Avatar for MasterGberry
0
147
Member Avatar for tchild

I think you have line 11 backwards, it should be [code] alphabet[i] = line[i]; [/code] also, I'd probably just change the program so that it looks like: [code] int main() { char alphabet[27]; cin.getline(alphabet,27); char line[50]; cin.getline(line, 50); /* Do things with line now */ } [/code] This has the …

Member Avatar for ravenous
0
137
Member Avatar for simply_viks

[QUOTE=Narue;1441684]It eliminates the need for a std:: prefix by importing all of the names in the std namespace to the current scope. That can be a bad thing because you're not likely to use all of the names that were imported, and you might be using other libraries that use …

Member Avatar for hillstone_softw
0
187
Member Avatar for MasterGberry

Try replacing the [icode]do{ ... }while()[/icode] loop with a [icode]for[/icode] loop, like: [code] for(unsigned i = 0; i < numOfSplit - 1; i++){ endPos = src.find_first_of(delim,startPos); std::string::size_type length = endPos - startPos; if(length != 0) result.push_back( src.substr(startPos,length) ); startPos = endPos + 1; } [/code] This would also fix the …

Member Avatar for ravenous
0
199
Member Avatar for Krstevski

When you start the [icode]int[/icode] with a zero, I think it's getting interpreted as an octal number and then output as a decimal conversion of this. Try the code below: [code] #include <iostream> using namespace std; int main() { int x1 = 010; /* interpreted as an octal number */ …

Member Avatar for WaltP
0
183
Member Avatar for moroccanplaya

It's almost certainly not a problem that's caused directly by putting a [icode]break[/icode] in the [icode]while[/icode] loop. It will be something to do with the many custom functions that you have in there. However, we can't see what they are at the moment. I'm not asking you to post the …

Member Avatar for sbesch
0
86
Member Avatar for pucivogel

I'm guessing from your code that you might want to keep executing the lines that tell the user to chose a number and then process the choice to output the correct line from the switch statement. You could do this by recursion (although you have it a bit muddled here, …

Member Avatar for ravenous
0
211
Member Avatar for Arbus

Yeah, I don't know but I'd imagine that this would be a massive security hole if the operating system let do it! In any case, I don't think that there's anything that you could do in C++ that would give you this behaviour, since your C++ code doesn't come into …

Member Avatar for ravenous
0
97
Member Avatar for remo25

Which particular nested loops are you talking about? Perhaps it would be better to give a small test program as an example, one that contains only the bit that you want to know how to fix. This way people will be able to see how to help you a bit …

Member Avatar for ravenous
0
594
Member Avatar for saadahkh

There are 3 [icode]getline()[/icode] calls in your example, which one is causing the problem? Could you make a simple piece of code that shows the problem and doesn't have a lot of extra stuff in it? That way it might be easier for people to help you out.

Member Avatar for WaltP
0
516
Member Avatar for gth759k

I don't use this library or anything, but what it sounds like you want to do is dynamically create some equivalent to [code] vector< someType > origin; [/code] so that you can later refer to it like: [code] origin.at(n).doSomething(); [/code] I don't think you can do this. The way that …

Member Avatar for ravenous
0
244
Member Avatar for johans22
Re: help

I'm assuming this is a kind of simplified version of what you're actually trying to do, since this is a very simple example. If so, then you can multi-thread your code using an external library, there's no in-built multi-threading in C/C++. Popular cross-platform libraries for this are the Boost.Thread library …

Member Avatar for johans22
0
101
Member Avatar for sanjanac++

If your professor has made it compulsory to use TC++ then couldn't you ask him/her to provide you with a working version that includes all the header files that you need? If not, then what is the error that tells you that windows.h is not included in your version of …

Member Avatar for ravenous
0
95
Member Avatar for Lando_

If that is the actual code that you're trying to compile then you should also be getting an error from the compiler due to the lack of braces to enclose the [icode]main()[/icode] function. Also, when you declare the header files you have use [icode]#include <iostream.h>[/icode], which is deprecated. Instead, you …

Member Avatar for jember
0
2K
Member Avatar for moni94

I do not get the behaviour that you describe. For input values of n = 1 and m = 10, [icode]getOps()[/icode] returns 3 and [icode]ops[/icode] is set to 4. This is because, in this case the [icode]getOps()[/icode] returns from line 8. Since you're using [icode]ops++[/icode] the value of [icode]ops[/icode] is …

Member Avatar for moni94
0
204
Member Avatar for by_stander

You can read in files using [icode]fstream[/icode] objects. I posted something about this a couple of days ago [URL="http://www.daniweb.com/forums/thread331237.html"]here[/URL] (you have to scroll down a bit to get to the part where the original poster has got their point across). Give that a go and see how you get on. …

Member Avatar for jonsca
0
237
Member Avatar for gaurav_13191

Are you initialising [icode]s.top[/icode] to 0 before you try to do [icode]top++[/icode] or [icode]top--[/icode]?

Member Avatar for gaurav_13191
0
183
Member Avatar for pinkannu

Hi There, I think line 5 has a missing "*" between 255 and [icode]sizeof(UINT8)[/icode], it should read: [code] VidZone[Loop].pui8Source[FileIndex] = (UINT8 *)malloc(255 * sizeof(UINT8)); [/code] Also, please use [ code ] tags, as it helps other people understand your code.

Member Avatar for pinkannu
0
119
Member Avatar for MarounMaroun

line 16 is [icode]for(int j=0;j++;j<5)[/icode], it should be [icode]for(int j=0;j<5;j++)[/icode] (the [icode]j++[/icode] and the [icode]j < 5[/icode] are swapped around).

Member Avatar for alexchen
0
84
Member Avatar for abelingaw

You could assign each star sign a number then store each of the two choices in a variable and compare them afterwards. I would also break your code into pieces by making some functions that work out the star sign and do the comparing. Like this: [code] #include <iostream> #include …

Member Avatar for abelingaw
0
604
Member Avatar for amari ♥

What code have you written so far? If you post the bits you have then people can help you to improve it so that it does what you want it to.

Member Avatar for ravenous
0
112
Member Avatar for MasterGberry

Your "=" operator is just returning the original vector. You need to set the values in the current vector using those from [icode]b[/icode] I think you should use something like: [code] const Vector &Vector::operator=(const Vector &b) { x = b.x; y = b.y; return *this; } [/code] The [icode]return *this[/icode] …

Member Avatar for MasterGberry
0
147
Member Avatar for bretttmczk

You're passing [icode]choice[/icode] by value to the function [icode]menu()[/icode], I think that you should use: [code] menu(&choice); [/code]

Member Avatar for bretttmczk
0
235
Member Avatar for snipermann

What is it that you don't know how it works? VC++, XML, C++, [icode]fstream[/icode] or all four?

Member Avatar for ravenous
0
602
Member Avatar for alexchen

OK. Do you have a problem that you don't know how to solve? Or a question that needs to be answered? If so, you might need to post a few more details before anyone can help you. What do you mean by "without repeating"? If you want random numbers between …

Member Avatar for ravenous
0
18K
Member Avatar for alexchen

You probably need to just have a quick look at the methods in the [icode]std::string[/icode] class, [URL="http://tinyurl.com/2w3v7gw"]try this[/URL] :o)

Member Avatar for alexchen
0
1K
Member Avatar for iCode@Night

OK, I think I see roughly what you're trying to do. I have some general points though: line 22: Be careful of reading text in like this, it's delimited by [i]any[/i] whitespace. So for a line like [code] <a href="http://www.some.url.com" target="_blank"> [/code] your variable [icode]line[/icode] with take the value [icode]<a[/icode] …

Member Avatar for ravenous
0
139
Member Avatar for mayanktalwar

Are you doing this as an exercise in learning more C++? If not, then there are probably already a bunch of things that can do this already. If you're going to do it as a project to learn something, then you should probably start by trying to find some details …

Member Avatar for ravenous
0
153
Member Avatar for BrianTurkish

You need some code between lines 72 and 75 to actually populate your vector with the information that you have about the letter counts. This is where the [icode]std::vector::push_back()[/icode] method that jonsca is talking about would come in. So, you'd have some loop that looked like: [code] for(int i = …

Member Avatar for ravenous
0
155
Member Avatar for aquario20

Please don't hijack threads. Start a new thread for your question, and use code tags for your code.

Member Avatar for ravenous
0
103
Member Avatar for Taggize

Hi, your code is almost complete! But there are a couple of things that you should consider to tidy it up a bit. Firstly, when you check for a file being open, it's better to check if it's [i]not[/i] open. This way, the whole of your code doesn't end up …

Member Avatar for ravenous
0
179
Member Avatar for skorm909

I don't know what the solution is, but the problem seems to be with visual studio not being able to find any of the dll that it needs. Did you try a forum for visual studio, or searching for any of the errors on Google?

Member Avatar for jonsca
0
259
Member Avatar for Transcendent

What does it mean to say [icode]*max > *iter[/icode]? This is comparing two strings and asking which is greater. I'm not sure that you can do this. What would be the result of "hello" > "Monday", for example? Do you need to use [icode](*max).length() > (*Iter).length()[/icode] instead? Also, I think …

Member Avatar for abdelhakeem
0
226
Member Avatar for ayeshakanwal

OK, [icode]CvRunningAvg()[/icode] seems to be a function from the Emgu OpenCV .NET implementation. You might have more luck posting this problem on their discussion forum at [URL="http://www.emgu.com/forum/viewforum.php?f=8"]http://www.emgu.com/forum/viewforum.php?f=8[/URL], since there will be many more people familiar with this specific set of libraries there. A piece of advice though: They're [i]definitely[/i] going …

Member Avatar for jonsca
0
225
Member Avatar for ChEeZeBaLL

Hi there, This isn't something that I've done my self before, but to write the data back to the file I think that you need to open the file with [icode]r+b[/icode] like you said and then use [icode]fseek()[/icode] to get to the part that you want to start writing and …

Member Avatar for Dervish1
0
1K
Member Avatar for Vindal

Hi there, If I were you, I'd split the program by making two functions, one that reads in the temperatures and another that gets the average. (I'm assuming that you want to average the high temps. across the week and the same for the low temps, if you want to …

Member Avatar for Vindal
0
2K
Member Avatar for r@o

You probably need to be a bit more detailed about what it is that you're trying to do here. For example, what do you mean by "add two equations"? Also, you're more likely to get some useful advice if you've attempted to write some code, but it has a problem …

Member Avatar for ravenous
0
76
Member Avatar for ak47kumar1

Hello, This code is indeed in C, and there are some things that you're trying to do that would be easier in C++. However, I think your problem here is that you have [ICODE]#define MAX_ELEM 365[/ICODE] and then you declare [ICODE]double A[MAX_ELEM][MAX_ELEM][/ICODE], which is going to try and reserve 365x365 …

Member Avatar for ravenous
0
114
Member Avatar for malayasthana

You have no hope of a reply to this request without more details. [icode]sPSActionControl[/icode] appears to be from the Adobe Photoshop SDK, maybe it would be better to ask about specific error codes on the forum for this specific SDK which is at [URL="http://forums.adobe.com/community/photoshop/photoshop_sdk"]http://forums.adobe.com/community/photoshop/photoshop_sdk[/URL]

Member Avatar for ravenous
0
126
Member Avatar for bufospro

I'd do this: read your data into [ICODE]std::list< std::vector< int > > data[/ICODE]. then you can use a series of loops like: [CODE] std::vector< int > allResults; /* Go through all the lines, using an iterator */ std::list< std::vector < int > >::iterator it = data.begin(); while(it != data.end()){ int …

Member Avatar for bufospro
0
123
Member Avatar for abuka

What are the errors? When do you get them (during compilation or when you run the program)?

Member Avatar for abuka
0
236
Member Avatar for Plastix!!

OK, this problem is not that hard and there are people here who can help you. However, you need to give people something to go on. For example, you say that your code doesn't work, but you don't say what it's supposed to do if it did work. It appears …

Member Avatar for ravenous
0
70
Member Avatar for hanttaha

Just a quick note on your code: you should use [CODE] #include <iostream> #include <cmath> #include <iomanip> [/CODE] instead of [CODE] #include <iostream.h> #include <math.h> #include <iomanip.h> [/CODE] These are the old, C-style way of doing it :o)

Member Avatar for ravenous
0
3K
Member Avatar for yardi

It sounds like you don't know a whole lot about programming in general. Is there a special reason why you want to attempt this in C++? If not, I would suggest that you make a spreadsheet in Excel (or your favourite open source spreadsheet program). You could have the names, …

Member Avatar for ravenous
0
125

The End.