2,827 Posted Topics

Member Avatar for ConfusedStudent

Please re-post with code tags and formatting. [noparse] [code] // paste code here [/code] [/noparse]

Member Avatar for VernonDozier
0
303
Member Avatar for baconswife

Re: Formatting. It's very important. Get Visual C++ and let it format for you. Let it "detabify" for you too and everyone's happy. Regarding code like this: [code] void initialize(int countFemale, int countMale, float sumFemGPA, float sumMaleGPA) { float FemGPA = 0.0; float MaleGPA = 0.0; countFemale = 0; countMale …

Member Avatar for VernonDozier
0
328
Member Avatar for Miyamoto

[QUOTE=Miyamoto;610946]Checking the entire vector will take O(n) time. What that means guys?[/QUOTE] The base is base 2 when you refer to logn or nlogn. Thus if n = 16, O(logn) = 4 since 2^4 = 16. Searching a balanced binary tree often takes O(logn) time since the depth of a …

Member Avatar for arkoenig
0
980
Member Avatar for Hugers

[QUOTE=Hugers;801290]Hello, Is there any way to eliminate debt by taking any short term loan?[/QUOTE] This is a contradiction in terms. If you take out a loan, you're in debt. If the question is: Can I take out a loan that isn't due till next month in order to pay my …

Member Avatar for dexter737
0
244
Member Avatar for jwill222

Here's your code formatted and with the excess spacing removed. It's much easier to follow: [code=C++] #include <iostream> using namespace std; int main() { int checks = 0; double balance,fee; cout << "Hello What's Your Balance? "<<endl; cin >> balance; if (balance <400 && >=0 ) { cout << "HOW …

Member Avatar for jwill222
0
4K
Member Avatar for arithehun

You haven't gotten a response because the question is a bit vague. You'll have to say what type of robot it is, the exact type of programming you'll be doing, etc. It's pointless to just learn C and C++ because you'll be learning things that you probably don't need to …

Member Avatar for arithehun
0
1K
Member Avatar for ZIPB

Not sure what you are trying to do. You'll have to provide a more in-depth example. Here's a link to an example on how to overload the + operator and how to call it. Scroll to the bottom. [url]http://msdn.microsoft.com/en-us/library/5tk49fh2%28VS.80%29.aspx[/url]

Member Avatar for VernonDozier
0
146
Member Avatar for lynneh3979

[QUOTE=lynneh3979;1373503]I need to add "x" to every other letter in the array so that I can print out Ax Cx Ex etc. I do not know how to append the "x" it he letter in the array and write it to another array.[/QUOTE] If you need to append letters, then …

Member Avatar for VernonDozier
0
145
Member Avatar for bookmark

Get rid of the word "double" in line 10: [code] cout << double grossPay(a,b); [/code] Change it to this: [code] cout << grossPay(a,b); [/code] That solves that problem but you have quite a few other problems in your grossPay function. For instance, what is this line supposed to do? [code] …

Member Avatar for bookmark
0
452
Member Avatar for sunrunner23

[code=C++] int value1 (int a[]) { int i; cout << "Enter a integer less than 30 "; cin >> a[i]; i=0; i < counter-1; i++; return a[i]; } [/code] No clue what you are trying to do here. Line 6 doesn't make any sense to me. Is this a for …

Member Avatar for VernonDozier
0
86
Member Avatar for swamper79

One, make g a global constant (i.e. define it BEFORE, not INSIDE main). Then move your code outside of main and call it from main. You already have the formula: [code] d = ((.5)* g * s * s); [/code] Make a function out of it: [code] double getDistance(double s) …

Member Avatar for VernonDozier
0
88
Member Avatar for jjspikejones

I just helped someone via PM (I know, not supposed to do that ;)). The same post applies here, so I'll recreate it verbatim. Here's the way it works. [code] // #include statements using namespace std; // function declarations (include semicolons) int main() { // function calls return 0; } …

Member Avatar for VernonDozier
0
110
Member Avatar for banks2140

And...? What's the question? Line 15 is a seg fault, line 17 has the quotes in the wrong spot and the slash backwards, and everything stops after line 18. I assume there's more?

Member Avatar for banks2140
0
78
Member Avatar for jjspikejones

Well, how about reading in the input and passing it to rightPrime. Make isPrime just return 1. Make rightPrime just call isPrime and return the value. Then harness that return in main and display a result. That gives you a skeleton. Then write isPrime and get it working. Then write …

Member Avatar for Fbody
-2
160
Member Avatar for rebellion346
Member Avatar for rebellion346
0
88
Member Avatar for Jake1905

General pseudocode: [code] float userInput; bool goodData; do { goodData = true; // ask the user for input, stick the input in userInput // test whether the user input is good if(/* test for good input fails */) { // display error message goodData = false; } } while(!goodData); // …

Member Avatar for VernonDozier
0
126
Member Avatar for C++Challenged

You need to: [LIST=1] [*]Use code tags. [*]Take whatever you professor gave you and turn it into your own words. We hsve no idea, for example, what Appendix 3 is, so don't refer to it. [*]Tell us what the problem is. You're stuck, but where? [*]Does it compile? Does it …

Member Avatar for hardatwork
0
143
Member Avatar for baconswife

To take code out of main and put them in functions, start with what you have: [code] #include <iostream> #include <iomanip> #include <cmath> using namespace std; const double pi = 3.1416; int main () { float x1, x2, y1, y2; float distance, circumference, area, radius; cout << "Enter the x …

Member Avatar for Fbody
0
2K
Member Avatar for Greywolf333

[QUOTE=Greywolf333]Hey all, I've been using Visual Studio for a long time. Lately though, after I build an executable successfully, it won't let me build it again for a solid 60 seconds or so, claiming that, for example, test.exe is still in use (when it's clearly not, because if I go …

Member Avatar for Greywolf333
0
94
Member Avatar for Nathaniel10

>> What will happen if I run a program with an infinite loop? I am very reluctant to run such a program because I am fearful of doing something I can't undo. I doubt there's anything to "undo". If you run a program with code like this: [code] while(1) { …

Member Avatar for Nathaniel10
0
1K
Member Avatar for Fbody

Exact same behavior for me as you got in your first post. It has NOT fixed itself for me. I've seen it a lot with several ads.

Member Avatar for Fbody
0
414
Member Avatar for Rickay

[QUOTE=Rickay;]I am using headers to include all of the functions, but I cannot wrap a loop around an entire program that is contained in more than one file. But I figured it out, I made a duplicate function called main1() and included the same syntax as that in main(), and …

Member Avatar for dylank
0
240
Member Avatar for Ana_Developer

[code] char* charArray[3]; strcpy(charArray[0],"wn"); strcpy(charArray[1],"chair"); strcpy(charArray[2],"-over"); [/code] You allocate memory for the pointers to the strings, but not for the characters themselves. Try replacing replacing the first line with this: [code] char charArray[3][20]; [/code] Make sure none of your strings have more than 19 characters though!

Member Avatar for VernonDozier
0
99
Member Avatar for Glass_Joe

I have to admit that I used to play a decent amount of Grand Theft Auto and its variants. I'll also confess that, while I normally play the part of a G.I. in video games, I've occasionally played on the Nazi side. Playing for the Taliban side seems a bit …

Member Avatar for kes166
0
903
Member Avatar for endsamsara

Hi, Do you have a specific question on how to code these algorithms in Java, or is this a game theory question where you have some algorithms but aren't sure how to use them to solve your puzzle/problem? In other words, in order to offer you help, do we need …

Member Avatar for Weixing
-1
5K
Member Avatar for Ferny84

You never attempt to read a file. You read in a filename, but there is no attempt to read the file. [code] char filename; [/code] filename needs to be a string, not a char. [code] cin >> filename >> endl;[/code] Don't read in the endl. Just read in the filename. …

Member Avatar for Ferny84
0
134
Member Avatar for power_computer

Tackle the math first. You need to understand the algorithm first. That's an algorithm problem, not a programing problem. It's also pencil-paper or better yet, whiteboard since you'll be erasing a lot. Two cells are disjoint if you can't get from one to another. The trivial way to do this …

Member Avatar for VernonDozier
0
1K
Member Avatar for davebrown2242

[code=cplusplus] #include <iostream> #include <string> using namespace std; int main() { double num; bool prime; cout<<"This is my program check if a number is a Prime number, also a Perfect Number!"<<endl; cout<<"Enter a number between 1 and 1000 "<<endl; cin>>num; if ((num<=0)||(num>1000))//SETTING UP THE FIRST ERROR MESSAGE { cout<<"Error, Please …

Member Avatar for garu525
0
177
Member Avatar for Ptap03

I don't see a << operator for your class. You need one. There are some good threads on the subject on Daniweb. Here's one. [url]http://www.daniweb.com/forums/thread137909.html[/url]

Member Avatar for VernonDozier
0
461
Member Avatar for xiansen

Line 43. You prompt the user for input, then immediately exit the program. Presumably there should be a cin statement after line 43 and before line 45, then you'll want to do something based on what the user entered.

Member Avatar for xiansen
0
174
Member Avatar for VernonDozier

I forgot I wasn't logged in and proceeded to write a really fantastic post, if I do say so myself. To no avail. I "submitted" it, but was told I wasn't logged in. Reasonable enough, but then I couldn't get back to the post. Two possible solutions. [LIST=1] [*]Have the …

Member Avatar for AndreRet
2
287
Member Avatar for Talguy

As with many such questions the answer is "it depends". You have to start with the group you are dealing with. I've had disappointing results in robotics projects, mainly due to a lack of common agreement as to what the commitment level was. Some people thought it was a cool …

Member Avatar for N1GHTS
0
120
Member Avatar for blackrandom

You don't pass data from one array to another. You can pass an array to a function. That array is the address in memory of the first element. One way or another, for the function to use the array, it needs the address where the array is located. There are …

Member Avatar for VernonDozier
0
100
Member Avatar for kakaliki

I don't see the math bbCode. I think the OP means 15 = 1^2 +1^2 +2^2 +3^2 = 1 + 1 + 4 + 9 = 15 where ^ represents raising to a power. To the OP : Pencil and paper till you see a pattern. Get the math down …

Member Avatar for kakaliki
0
270
Member Avatar for Suzie999

[QUOTE=Suzie999]Is it possible to password protect a dll at compiletime. Please excuse my noobness, but let me explain what I mean. You app an runtine makes a lot of calls to a function in a library so it opens it and keeps it open for the duration your app is …

Member Avatar for Stefano Mtangoo
0
2K
Member Avatar for aviavyne

>> The problem is that there are some things that i don't know what it stands for or what it does Like what? If you don't understand the formulas, then a math/statistics forum might be a better place to ask. Google "standard deviation example" and you'll get thousands of hits. …

Member Avatar for mike_2000_17
0
295
Member Avatar for cortez716

By now if no one has told you how to use code tags, I will: [noparse] [code] // code here [/code] [/noparse] [code] #include <iostream> using namespace std; int main() { int x,y; char z; char q; cout<<"please input an expression (two numbers and a function) to be solved, when …

Member Avatar for VernonDozier
0
126
Member Avatar for cogitoergosum18

I answered your last thread. If the current thread is here, mark the old one closed. Way too many unnecessary brackets, but that's not the problem. The problem's simple. Replace the comma at the end of line 10 with a semicolon and recompile. Always go to the FIRST error and …

Member Avatar for prvnkmr449
0
245
Member Avatar for ezkonekgal

You have a two dimensional array, so you need to dereference it twice. [code] arr[i] = (char)i; // wrong. arr[i] is an address, not a char. arr[i][0] = (char)i; // right. now it's a char. [/code]

Member Avatar for prvnkmr449
0
114
Member Avatar for 4824hbk

Please use code tags: [noparse] [code] // code here [/code] [/noparse] Try this. [code] bool withdraw(double amt, int pin){ if (amt <= bal) return true; if(amt >= bal) return overDraft(pin); } bool overDraft(int pin){ if (pin ==123) return true; if(pin==456) return false; if(pin==789) return true; }[/code]

Member Avatar for mike_2000_17
0
100
Member Avatar for cogitoergosum18

No, there is no possible way to switch on a string. But you aren't even trying to switch on a string. You have x defined as an int. Also, don't confuse single and double quotes. Strings use double, not single quotes. Perhaps you want something like this? [code] int colortonumber …

Member Avatar for VernonDozier
0
304
Member Avatar for kakaliki

You're stuck at the loop section? You don't HAVE a loop section. If you mean "I can't figure out how to CREATE the loop section", say that. Presumably you need help with this section? [quote] FOR count = 1 TO number of decades DO FOR inner count = 1 to …

Member Avatar for VernonDozier
0
573
Member Avatar for ASTA LAVISTA

Am I the only one who STILL doesn't understand what the requirements of this assignment are? I've been following this thread. Apparently initially everyone was as confused as I was, but then a few posts back, everyone else "got it". I'm still as confused as I was twenty posts back. …

Member Avatar for ASTA LAVISTA
0
412
Member Avatar for kra9853

You have several tasks: [LIST=1] [*]Tell the user exactly what they need to enter for input. [*]Verify that the input is good. If not, give them an appropriate error message and prompt them again. [*]Convert THEIR input into something that you can stick into a formula and calculate. [*]Give the …

Member Avatar for Valaraukar
0
174
Member Avatar for kgNIU

Some possibilities: [LIST=1] [*]Data is read in incorrectly. [*]Data is sorted incorrectly. [*]Data is displayed incorrectly. [/LIST] Stick a call to your display before and after the sort. If it's all 0's BEFORE the sort, then ignore the sort function. If it looks good BEFORE the sort, but after the …

Member Avatar for VernonDozier
0
95
Member Avatar for galmca

[QUOTE=towhidd;617470]i want to know how to dispaly a series of number. Supose an user input a number(40). The progrme will generate and display like this way: 1-prime 2-not prime 3-prime 4-not prime 5-prime 6-prime upto 40-prime plz solve my proble. I will b grateful to u.[/QUOTE] One, you've already asked …

Member Avatar for ramesh thota
0
469
Member Avatar for XodoX

Well, first you have to write the programs themselves. Then set up some counters for the number of operations and do some time calculations. After that, start plotting and find a math equation. Note that you might need something more precise than seconds. [code] // global int numOps; void SomeRecursiveRoutine(int …

Member Avatar for XodoX
0
145
Member Avatar for mchin131

Word is "abcdefghij". Valid indexes are 0 through 9, inclusive. You want to pick two indexes and swap the letters. [code] int index1 = /* random number */ int index2 = /* random number */ // swap char temp = word[index1]; word[index1] = word[index2]; word[index2] = temp; [/code] First and …

Member Avatar for VernonDozier
0
3K
Member Avatar for GrimJack

Frankly I think this is a FANTASTIC way to use one's time. If I had the time and the resources, I'd try to use my time the same way. It looks more interesting than MY job.

Member Avatar for VernonDozier
0
55
Member Avatar for emko

Not sure what your approach is, but you need to either change the data members in your class or you need to have more class object. Right now you have one object and it stores one character and one long. You need one character and one long for each ASCII …

Member Avatar for mrnutty
0
258

The End.