1,426 Posted Topics

Member Avatar for butterfingerss

What do you mean by they didn't work? You should be able to compile the following program on any standard compliant compiler. #include <iostream> #include <string> int main() { std::string helloWorld = "Hello World!"; std::cout << helloWorld << std::endl; // to pause the program std::cin.get(); return 0; }

Member Avatar for Moschops
0
2K
Member Avatar for johnykf

So what do you have so far? This site is not about giving it is about helping. If you put in the effort we will **help** you. **help** does not equal **do**.

Member Avatar for David W
0
195
Member Avatar for ashley.vanhoesen.7

Ashley I would rewrite your last post as void copy() { string x; // do I still have input? if (cin >> x) { cout << x << endl copy(); } // if no input remains return return; }

Member Avatar for NathanOliver
0
1K
Member Avatar for mary.fatulalohr

`int arr_3d[4][3]` means make an array with 4 rows and three columns. On line 9 you have `{1, 2, 3, 4}`. How many columns are in that row?

Member Avatar for David W
0
163
Member Avatar for Rashmi_1

There was a thread that I participated in a few years back and maybe you will get some insight from it. It was a natural string comparison challenge by Narue. As an FYI I wouldn't post anything to that thread since it so old. http://www.daniweb.com/software-development/cpp/threads/259447/c-challenge-natural-sorting

Member Avatar for Rashmi_1
0
907
Member Avatar for kimanthi

That comes from mixing input types. Mixing `cin >>` with `getline()` will cause this. One way to stop it is to put `cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n')` after every call to `cin >>`. You will need to include the limits header for this to work.

Member Avatar for kimanthi
0
251
Member Avatar for ashley.vanhoesen.7
Member Avatar for NathanOliver
0
287
Member Avatar for Labdabeta

Well ╠ is expressible by the ascii code of 204. As far as working with unicode you might want to look into the std::locale library.

Member Avatar for Labdabeta
0
438
Member Avatar for Yogesh_9

You need to change all of your comparisons in your loops from `<= end` to `< end`. The reason for this is if `i` or `p` equals `end` then you are one past the end of the array and reading data that my not belong to you and thus returning …

Member Avatar for StuXYZ
1
376
Member Avatar for Mohamed_31

What do you have so far. We will not do your work for you. Converting centimeters to meters and kilometers is a pretty simple process. I will give you a hint though. Since you are going to be dealing with very large numbers you should do this with strings instead …

Member Avatar for Elixir42
0
147
Member Avatar for tharindu123
Member Avatar for ansar.ahmed.7967

All of your code is compiled by the compiler. As far as you loop question is concerned look at this: for (int i = 0; i < 10; i++) { for (int j = 0; j < 5; j++) { std::cout << j * i << std::endl } } The …

Member Avatar for NathanOliver
0
116
Member Avatar for Vasthor

So you have a set that hold all of the line numbers a give word appears? Then you need to store all of the words in that text with thier related set in another container? If that that case the map should be keyed by the word and the set …

Member Avatar for NathanOliver
0
211
Member Avatar for alhawsa
Member Avatar for Suzie999

You could pipe the cmd text to a file and then parse that file for the information that you need.

Member Avatar for Suzie999
0
324
Member Avatar for Damian_2

@ OP if you have a compiler that supports c++11 than you can use the std::map initializer list constructor. It would change your code to loo like this void ArcherArmor::ArcherArmor_shop(){ soldier_armor = {//name, damage, price std::make_pair(1, Armor("Meito Ichimonji", 4, 150, 1)), std::make_pair(2, Armor("Shusui", 10, 230, 2)), std::make_pair(3, Armor("Apocalypse", 16, 300, …

Member Avatar for Damian_2
0
746
Member Avatar for skylinedrifter

You are missing a return stament in your main function as well as a closing curly brace for the main function.

Member Avatar for Slavi
0
196
Member Avatar for Learner010

The only way I know to make a pointer array with x values is the following. int * numbers = new int[x]; // where x equals some integer number

Member Avatar for deceptikon
0
161
Member Avatar for prashantsharmazz

Okay. what do you have so far? You can take a look at [this](http://www.cs.mtu.edu/~shene/COURSES/cs201/NOTES/chap04/arms.html).

Member Avatar for NathanOliver
0
176
Member Avatar for Bhat kamran
Member Avatar for Sanjeetjmp

Check this out [Click Here](http://www.parashift.com/c++-faq/inline-functions.html)

Member Avatar for Ancient Dragon
0
219
Member Avatar for javed.iqbal.3979

What is fil3? You are oppening account.txt in `inFile.open("account.txt",ios::in);`

Member Avatar for NathanOliver
0
156
Member Avatar for nhrnjic6

Get rid of line 14. On the last time through your loop you will reach the end node which shouold be null. Then line 14 tries to access it and since it is null it will throw a fault.

Member Avatar for nhrnjic6
0
323
Member Avatar for rowen_1
Member Avatar for CoolAtt

Try this and let me know If you get the second cout statement #include <iostream> using namespace std; class A { private: int _dmember; public: void func() { cout<<"Inside A!! "<<endl; cout<<_dmember; // } }; int main () { A *a=NULL; a->func(); // prints "Inside A!!!" cout << "We are …

Member Avatar for CoolAtt
0
320
Member Avatar for marc.orocay

No one is going to do your work for you. There is little difference in a do-while loop compared to a for loop. Yopu just have to make your own counter and take care of it with a do while loop versus a for loop. Here is how you can …

Member Avatar for NathanOliver
-2
223
Member Avatar for Schol-R-LEA

I'll throw in my two cents as well. I am currently going to college here in the states and from what I have seen in my classes most programmers are doomed. Our C++ class was basically C with classes at the end. I had a couple of java classes as …

Member Avatar for Ancient Dragon
1
2K
Member Avatar for maryyy
Member Avatar for learncoding
Member Avatar for merry gold

So besides the fact that your code is almost complete unreadable whats your problm?

Member Avatar for Schol-R-LEA
0
151
Member Avatar for richieking

I actually prefer seeing `int clocks_per_ms = CLOCKS_PER_SEC / 1000;` to `int clocks_per_ms = 1000;`. It lets the person reading the code now exactly what you want to do. Also since it is a constant being divided by a constant it will be optimized away to `int clocks_per_ms = 1000;` …

Member Avatar for deceptikon
0
2K
Member Avatar for princessophia
Member Avatar for Jiggle

this is from lazyFoo's faq page Q: Can I use your code to make a game? A: Basically my rules are: 1) If you're using it for a closed source program, go nuts. 2) If you're using it for an open source program, please cite the chunks of code you …

Member Avatar for Gabriel_2
0
335
Member Avatar for bugmenot

This is from line 023 double AreaOfTriangle This is from line 102 double AreaOfTrianglw Notice anything wrong? Also dont hijack and old thread with a new problem. Start a thread instead.

Member Avatar for NathanOliver
0
2K
Member Avatar for pphamtuan

What is the full error you are getting. Just posting 400+ lines of code and a partial error message as your title generally doesnt get you very far.

Member Avatar for Ancient Dragon
0
402
Member Avatar for chubbyy.putto

In your function you need to declare a local variable to hold the sum of the array elements and then return that. You do not want to store the sum in `n`.

Member Avatar for Learner010
0
107
Member Avatar for furalise
Member Avatar for Tyler_1

How would you write code without using functions or classes? From what I know about code creation you want to compartmentalize your code as much as possible. Breaking it up makes it easier to maintain and affords you the ability to change code in one spot and have it apply …

Member Avatar for Tumlee
0
320
Member Avatar for NathanOliver

Hey Daniweb, I have recently started working with threads in the c++11 library. I started with a simple dispatch mechanism where I have a queue and that would get passed to the threads and the threads would take turns emptying the queue. Since each thread needs to share the queue …

Member Avatar for NathanOliver
0
338
Member Avatar for Elias_2
Member Avatar for prettyknitty

Does this code actually compile? Your functions should like this: returnType ClassName::FunctionName (Paramaters) { // function code goes here } As far as your set cell function is concerned you could do it like void NumberArray::setCell(int index, double value) { arrayPointer[i] = value; } You should also make sure that …

Member Avatar for NathanOliver
0
220
Member Avatar for whatthebobo

On all of your loopps you are running to `SIZE`. If the user does not enter 100 elemtents then you will be using elements that have not been used. you need to change all of the for loops to run to `count` and that should fix it.

Member Avatar for whatthebobo
0
268
Member Avatar for Learningvinit

Are you trying to use a `shared_pointer` which has a count of how many objects hold the pointer?

Member Avatar for Learningvinit
0
525
Member Avatar for VUEKID

So you came up with the above code to read a file but you dont know how to output the resaults to another file?

Member Avatar for VUEKID
0
421
Member Avatar for bad.boy.Vlad
Member Avatar for vampersie
Member Avatar for SpottyBlue

Nevermind. I Though I saw something but realised I was wrong after posting.

Member Avatar for deceptikon
0
113
Member Avatar for royi.navon

you need to move the curly brace from line 60 to line 49 to put the if statement on line 50 outside your while loop.

Member Avatar for tinstaafl
0
138
Member Avatar for atzounis

Taking the code that you have and changing it a little bit you can make it look like this: int functionA(int a, int b) { return a + b; } int functionB(int a, int b, int c) { return c * x(a, b); }

Member Avatar for NathanOliver
0
269
Member Avatar for cambalinho

The End.