1,177 Posted Topics

Member Avatar for Buolbear4444

Please post the smallest compilable code that will produce this error. "undeclared identifier" in this case probably means that you didn't include the header file? Dave

Member Avatar for Buolbear4444
0
186
Member Avatar for 7h3.doctorat3

I would put the numerical representation of the number into an std::string. From here you can access each digit separately: [code] std::string number = "123"; std::cout << number[0]; //outputs '1' [/code] You would then have to have a giant switch statement to convert a '1' to "one", etc. Hope this …

Member Avatar for mrnutty
0
493
Member Avatar for sashaa

You're going to need to be a lot more specific than that! How are we supposed to know what you are trying to do?? Dave

Member Avatar for daviddoria
0
39
Member Avatar for shiva manhar
Member Avatar for Sw8Lala

getline() from iostream will do the reading and you should use ofstream to do the writing. Give this a shot. If it doesn't work, post a < 10 line demonstration of the problem. Dave

Member Avatar for Sw8Lala
0
171
Member Avatar for arpal

Look into "exceptions" (throw and catch). It won't be a magic solution, you have to predict the run time errors. But it is better than nothing. Dave

Member Avatar for Aranarth
0
121
Member Avatar for Covert06

Can you take the input as a string and then check the length. If it is more than say 10 characters you can output "please don't input such large numbers" or something.

Member Avatar for Covert06
0
239
Member Avatar for ghost_from_sa

First, you should fill these in!! [code] // void // Purpose: // Inputs: // Ouputs: [/code] They will really help your structure/logic. I am concerned that your sort() function should not be doing anything with fstream - you should read the data elsewhere and pass it to sort(). I would …

Member Avatar for ghost_from_sa
-1
133
Member Avatar for Andreas5

I wouldn't do everything in the constructor. I would make it more like this: [code] Search mySearch; mySearch.SetText("This is the text I want to search in"); mySearch.SetSearchString("want"); bool found = mySearch.Search(); [/code] This way you also can use the result in the calling function. Dave

Member Avatar for Andreas5
1
161
Member Avatar for matthewl

What is the error you are getting? Can you provide the smallest compilable piece of code that will produce this error, along with sample input, expected output, and current output? Dave

Member Avatar for matthewl
0
196
Member Avatar for JMC31337
Member Avatar for JMC31337
0
167
Member Avatar for j-green.10

You can access each digit using a std::string [code] std::string number = "NAB"; for(int i = 0; i < number.size(); i++) std::cout << number[i] << std::endl; [/code] Dave

Member Avatar for daviddoria
0
71
Member Avatar for anuragcoder

I posted an example of how to use boost regex in this thread: [url]http://www.daniweb.com/forums/thread288358.html[/url] Maybe it will get you started. Dave

Member Avatar for anuragcoder
0
118
Member Avatar for andrewmiron
Member Avatar for fyezool

fyezool, Of course we can appreciate that English is not your first language, but please try to use "proper" English, rather than numbers and single letter words ("u 2", "sorry 4", etc) Welcome to Daniweb. Dave

Member Avatar for maceman
0
70
Member Avatar for Martje

You should see if there is an XML parser library for c++. This is pretty much exactly the idea of XML. Otherwise, just read in line by line, check for '[', then keep reading all of the lines until you hit another '['.

Member Avatar for Ancient Dragon
0
1K
Member Avatar for sasTReSS

You should look into using ifstream. fseek, fgets, strtok, strchr, etc are all depricated.

Member Avatar for sasTReSS
0
356
Member Avatar for eng hassan

Please try to pose your question in a concise form such that it can benefit others in the future. That is, ask a question about c++, not about your program. Some recommended reading... [url]http://daviddoria.blogspot.com/2010/05/problem-abstraction-helping-others-help.html[/url] Dave

Member Avatar for eng hassan
0
583
Member Avatar for dansnyderECE

Yes, always use std::string!! What I really wanted to say was MAKE ABSOLUTELY SURE you comment any lines like [icode] 1<<x;[/icode] EXTREMELY well and TEST THEM INDIVIDUALLY FIRST. I would be extremely annoyed if I found some code like that without a comment with the equivalent math or pow() style …

Member Avatar for dansnyderECE
0
184
Member Avatar for XerX

NathanOliver - It sounds like he wants to do something with this function: [url]http://msdn.microsoft.com/en-us/library/dt12193b(VS.71).aspx[/url] I've never heard of the concept, but it doesn't sound like tie() does any actual outputting, but rather just forces an output to finish before starting an input. What NathanOliver just recommended was in your original …

Member Avatar for XerX
0
182
Member Avatar for God Coder123

Does this help? [code] int RandomInt(const int MAX) { //produce an int from 0 to MAX-1 return rand() % MAX; } [/code] Dave

Member Avatar for God Coder123
0
108
Member Avatar for Abiha

- Please use code tags and reasonable indentation. - Please tell us an example input, the current output, and the expected output. Dave

Member Avatar for daviddoria
0
116
Member Avatar for Sandhya212

I am using KDevelop and I got the same error (/bin/sh: double: No such file or directory). I added this to the top of your code instead: [code] #define COMPLEX std::complex<double> [/code] And it compiled and ran fine. It must be something wrong that we are doing with the -D …

Member Avatar for Sandhya212
0
563
Member Avatar for Crak

This code: [code] #include <iostream> #include <vector> using namespace std; int main() { #include <vector> std::vector<double> a; int i =0; while(1) { a.push_back(i); i++; } return 0; } [/code] produces [code] terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc [/code]

Member Avatar for daviddoria
0
111
Member Avatar for maryam ahmad

This is a pretty standard usage of switch. Have a look here: [url]http://msdn.microsoft.com/en-us/library/k0t5wee3(VS.80).aspx[/url]

Member Avatar for daviddoria
0
99
Member Avatar for drunkenmonk

I'd suggest building the smallest tree possible (a root and one leaf) and then stepping through with a debugger. Then you can see what is going on when you know exactly what SHOULD be going on. Good luck, Dave

Member Avatar for AkashL
0
130
Member Avatar for gtschemer

Can you tell us the application? Maybe someone will have a suggestion. Storing things as a void* always sounds like a bad plan to me...

Member Avatar for Banfa
0
129
Member Avatar for gtateco

Can you use a std::vector<list>? Also I would be very careful with the name "list". If somewhere else std::list gets included, then you're going to have conflicts. Dave

Member Avatar for mrnutty
0
3K
Member Avatar for vbx_wx

I don't understand the problem? I removed all of the code that we can't compile and the text and came up with this: [code] #include <iostream> #include <string> using namespace std; int main() { string test; cout << "1: " << endl; getline(cin, test); cin.ignore(); cout << test << endl; …

Member Avatar for vbx_wx
0
125
Member Avatar for Excizted

After some googling, it looks like if you want a really robust solution you should use something like Boost Regex [url]http://www.boost.org/doc/libs/1_35_0/libs/regex/doc/html/index.html[/url] If any of the experts here have a way to do it with std::string and std::algorithm only, that would be nice, but as soon as you allow multiple wildcards …

Member Avatar for NathanOliver
0
5K
Member Avatar for yossi321

This is surely an OS dependent question - I'd say the only way to do it in c++ would be with a system() call to the appropriate OS command. Dave

Member Avatar for yossi321
0
61
Member Avatar for programing

You should use a vector<string> or vector<char> if you want to store things besides ints. Better yet, why not use a stack<char> which provides all of the functions you are looking to implement already?

Member Avatar for daviddoria
0
82
Member Avatar for radioflyer1

Please try to make your titles and questions as abstract as possible. This way the "next guy" can search and find something usable. If you ask "How do I randomly select an element of an array?" that is much more reusable than "How do I make a horse finish first?". …

Member Avatar for griswolf
0
154
Member Avatar for Humaira Qureshi

Welcome to Daniweb! I have a few suggestion that will help you get the help you need. 1) Please use code tags. It will help everyone read your code. 2) Try not to post hundreds of lines of code. Each line takes the reader time to analyze, so you should …

Member Avatar for daviddoria
0
116
Member Avatar for bsse007

First, please use proper English (i.e. not "plz") when posting on Daniweb. I would use an std::map. Traverse the string a character at a time. If the element doesn't exist in the map, add it to the map as a key with value=1. If it does already exist in the …

Member Avatar for Radical Edward
0
127
Member Avatar for Wikedshorty
Member Avatar for lcfc12

Welcome to Daniweb! - Please use code tags when you post code. It makes it much more readable for other uses. - Please try to make the example as simple as possible to demonstrate the problem you're having. For example, in this case the drawing to the screen is taking …

Member Avatar for daviddoria
0
103
Member Avatar for daviddoria

I saw a post today that I said "hm I'd like to have a closer look at that tonight". Is there anyway to "mark" or "flag" a thread to put it in your "favorites" or something like that? Dave

Member Avatar for daviddoria
0
97
Member Avatar for daviddoria

Hi Dani et al., I don't know if you'll have any interest in this, but I'm going to describe what I have done over the past couple of years on an open source project that I think could be extremely beneficial to Daniweb as well. The project I work on …

Member Avatar for daviddoria
0
398
Member Avatar for Chris11246

There is a project called OpenCV (CV = Computer Vision) that is all about this stuff. You can also look at VXL, ITK, and VTK. Matlab also has many many image processing functions. Good luck, Dave

Member Avatar for daviddoria
0
106
Member Avatar for RayvenHawk

Instead of [icode][k++][/icode] why don't you try incrementing k outside of the [] so you know for sure when it is happening. Then output k and compare it to yourString.size() and make sure everything seems kosher. This error definitely means you are accessing the 5th character in a string of …

Member Avatar for RayvenHawk
0
199
Member Avatar for genux

What do these course numbers refer to? What are your other options? [this is not a c++ question and should be moved elsewhere]

Member Avatar for genux
0
72
Member Avatar for kalrajhi

You should definitely look into using a std::vector<int> instead of an array of ints. You can push_back() each element so the vector will grow to accommodate the new guesses. You could also use an std::set instead of an std::vector to "automatically" tell if a number had already been guessed. If …

Member Avatar for kalrajhi
0
253
Member Avatar for Excizted

If it were my problem I would copy everything into a new folder and start deleting things. For example: [code] bool isWriteable() { return m_Access == ACCESS_WRITE; } [/code] surely doesn't have anything to do with the problem. Once you've done all you can do, I bet you will have …

Member Avatar for Excizted
0
3K
Member Avatar for r1409

First, why not change the headers to [code] #include <memory.h> #include <cstdio> #include <cstdlib> //required for system() #include <iostream> [/code] to use the "new" way. Also, I think the "c++ way" is to use cout and endl instead of printf and \n. Now to the main problem The first output …

Member Avatar for daviddoria
0
639
Member Avatar for tundra010

Sure, just set a member variable before your destructor gets called, and reference that variable from the destructor. Dave

Member Avatar for tundra010
0
107
Member Avatar for erka4444
Member Avatar for tomtetlaw
Member Avatar for Curt1337

What is the problem? Can you simplify the code into a <20 line demonstration of the problem?

Member Avatar for Curt1337
0
320
Member Avatar for leesho

Also, there is no reason to use global variables here. Define number1,2,3 in main and then pass them by reference to the functions. Dave

Member Avatar for leesho
0
184

The End.