565 Posted Topics

Member Avatar for Starship12

Daniweb member rules state this: **Do provide evidence of having done some work yourself if posting questions from school or work assignments.** Post what you've done, and we'll take it from there.

Member Avatar for NathanOliver
0
121
Member Avatar for Gsterminator

Line 20: `mazeFile.open(file);` It should have been `mazeFile.open(file.c_str(), ios::in);` Lines: 121, 129, 137, 143 assignment to itself the `rows=rows` or `cols=cols`. Also, post the entire error. When separating the files into headers and cpp, in the header you should place only the declaration of the function, and in the cpp …

Member Avatar for Lucaci Andrew
0
247
Member Avatar for daino

CrossThread from [http://www.cplusplus.com/forum/general/83448/](http://www.cplusplus.com/forum/general/83448/). This is at most what I could come up with: [Linking libraries with codeblocks](http://stackoverflow.com/questions/5862757/how-do-i-link-to-a-library-with-codeblocks) [Building libraries with mingw](http://www.transmissionzero.co.uk/computing/building-dlls-with-mingw/)

Member Avatar for daino
0
599
Member Avatar for danibecse

Also, if a there is a static member you could see the total number of instances of that class from your entire program. #include <iostream> using namespace std; class StaticClass{ static int count; public: StaticClass(){ count++; } static void printCount(){ cout<<"Number of instances: "<<count<<endl; } }; int StaticClass::count=0; int main(){ …

Member Avatar for NathanOliver
0
219
Member Avatar for sonum04

Daniweb member rules sais this: **Do provide evidence of having done some work yourself if posting questions from school or work assignments**. I don't see any attempt of doing this program. Also, we won't just hand you the program. So start working on it, and only when you encounter problems, …

Member Avatar for np complete
0
102
Member Avatar for UNDER-18 FG

Here, this should do it. I just replaced the System.out.println(isPrime(n)); part, which would print true or false, with an if if (isPrime(n)) System.out.println("The number is prime.\n"); else System.out.println("The number is not prime.\n"); Here's the code: import java.util.Scanner; public class PrimeNumber{ public static void main(String args[]){ int n; Scanner Prime = …

Member Avatar for Lucaci Andrew
0
309
Member Avatar for mchung90

Looks find to me: /* * Output: * rachelhellogoodbye */ Try with the append function from the string class: while(getline(in,line)){ fullLine.append(line); } Or with insert: while(getline(in,line)){ for (size_t i=0;i<line.size();i++) fullLine.insert(fullLine.end(), line[i]); } Take a look at the getline method. If you don't provide any delimitter, the new line character will …

Member Avatar for nullptr
0
322
Member Avatar for akashi

I'll do it like this: Have a function that returns how many words are in a line, i.e. counts the number of spaces. Have a boolean function that checks if a string starts with a vowel or not Tokenize the entire line. Split the line into words. Check each word …

Member Avatar for Lucaci Andrew
0
927
Member Avatar for rajeshyadav6382

[http://lmgtfy.com/?q=sort+words+c%2B%2B](http://lmgtfy.com/?q=sort+words+c%2B%2B) Also, where's your attempt of doing the program?

Member Avatar for Lucaci Andrew
0
45
Member Avatar for rssk

Yes, indeed, but the saddest part here is that he's a member of daniweb since January 2011, having 51 posts already. By now, he should have already read at least some programming books, and if not, well...

Member Avatar for stultuske
0
2K
Member Avatar for Doogledude123
Member Avatar for deceptikon
1
266
Member Avatar for forjustincase

> Then iterate through each character of the string (using for-loop) and display the character using System.out.println(). or wasn't that clear enough? You have in your string the integer: like 150 to string is "150". What does that mean? It means that you transformed your integer into a collection of …

Member Avatar for JamesCherrill
0
262
Member Avatar for Seni0RRunn3r

try cin >> ch; num1 = cin.peek(); cin.ignore(80, '\n'); cout << ch << (char)num1; as the peek function reads and returns the next character without extracting it, leaving it as the next character to be extracted from the stream. So, if you still have a number, it will consider it …

Member Avatar for Seni0RRunn3r
0
2K
Member Avatar for kikechithomas

To quote the **Member rules**, which, by the way, you agreed on when you signed onto this site: **Do provide evidence of having done some work yourself if posting questions from school or work assignments**. We won't just hand you the program, it will do you no good, except maybe …

Member Avatar for Lucaci Andrew
0
145
Member Avatar for MasterHacker110

Load each line in a string, check if it matches a certain token, update it, than write it to a file. I would suggest using two files, the original, from which you will read, and the other on which you make updates: You read the original file, line by line, …

Member Avatar for Lucaci Andrew
0
418
Member Avatar for pjh-10

Either you insert the numbers in the array in reverse order and print the array normally for (n=i-1; n!=-1; n--) { cout << "Enter number: "; cin >> p[n]; } or normally insert items in the array, and print them in reverse order for (n=i-1; n!=-1; n--) cout << p[n] …

Member Avatar for Lucaci Andrew
0
162
Member Avatar for yigit.hatipoglu

How to find the average of positive numbers? Loop throughout your array/list, count how many positive and how many negative numbers you have, add them sore them in a variable accordingly, positive in one number, negative in another number, say `total_nr_of_positive_numbers` for positive numbers, and `total_nr_of_negative_numbers` for negative numbers, than …

Member Avatar for nmaillet
0
206
Member Avatar for ItecKid

**s.rasoly**, if you have a question please start your own thread, and not bump into a 3 year old one!

Member Avatar for Lucaci Andrew
0
5K
Member Avatar for minimee120

Use `String.replaceAll()` method to delete/replace strings: Here's a quick example to delete a string from a file: import java.io.*; import java.util.*; public class Iofile { public static void main(String [] arg)throws Exception{ System.out.println("Input file: "); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String input=in.readLine(); System.out.println("String to delete: "); String del=in.readLine(); File …

Member Avatar for Taywin
0
4K
Member Avatar for Carc369

Well, in your example you can't, because strcat requires two char*, whereas a and b are simple chars. What you can do is to work with strings: #include <iostream> #include <string> using namespace std; int main(){ char a='a'; char b='b'; const char* all; string together; together+=a; together+=b; all=together.c_str(); cout<<all; return …

Member Avatar for Lucaci Andrew
0
325
Member Avatar for Teaba W.

So you want to start programming in 3d, but my question is: what are your programming skills, are you a beginner or an advanced programmer. What are you trying to accomplish with this? Do you want to create a video game? Are you progrmaming a tool that handles 3d objects?

Member Avatar for Lucaci Andrew
0
55
Member Avatar for highonbikes

I don't quite get where's your problem, but I see you're trying to insert from a file, a matrix, and than display it: Probably the text file looks like this: 5 7 ******* *S***** *****E* ******* ******* where 5 is the number of rows, 7 the number of columns, and …

Member Avatar for Lucaci Andrew
0
153
Member Avatar for manraj kaur

Have you bother looking under Java tutorials? [Here](http://docs.oracle.com/javase/tutorial/essential/exceptions/), this might help you.

Member Avatar for jalpesh_007
0
359
Member Avatar for kayceedude

line 12 it's `++frequency[response[survey]];` not `++frequency[response[surv]];`. Use what **Software guy** gave you, basically, in there is your whole assignment. After that just print in parallel the arrays: the index and the element.

Member Avatar for kayceedude
0
467
Member Avatar for kamran.j

Well you could parshe the entire string, find out where the delimitters are, then split them. Perhaps you have some round/square/curly brackets as well, so you'll need to take that into consideration too. For tokenizing: [Click Here](http://www.cplusplus.com/reference/iostream/stringstream/) Converting to double: [Click Here](http://www.cplusplus.com/reference/clibrary/cstdlib/atof/)

Member Avatar for kamran.j
0
223
Member Avatar for sylvac.yuyu

Hi, and welcome to Daniweb. Looking forward to your questions and as well for an open mind in accepting the critiques/ideas (if there are).

Member Avatar for extr3mex
0
75
Member Avatar for Delnith

Well, Java comes with its own tutorials. I find this website really useful: [Click Here](http://docs.oracle.com/javase/tutorial/index.html)

Member Avatar for stultuske
0
276
Member Avatar for Magic681

Well probably. What you can do is to make functions of everything inside: if, for example, you have a comparison answer<guess, you could do a function that compares two numbers, if the first one is lower than the 2nd, it will return -1, if they are equal it will return …

Member Avatar for ravenous
0
388
Member Avatar for umesh314

Let's take it step by step: cout << ++a + ++a + ++a << endl; a=0. ++a increments first the variable, than use it in expression so: a=0; ++a=1; //so ++a + ++a + ++a = 7 a=1| a=2| a=2 2 + 2 |+ 3 | = 7 so let …

Member Avatar for Lucaci Andrew
0
252
Member Avatar for nitish.achar.9

[http://lmgtfy.com/?q=The+beginnings+of+computer+science](http://lmgtfy.com/?q=The+beginnings+of+computer+science)

Member Avatar for Lucaci Andrew
0
96
Member Avatar for lucasbernst

Another thing you could do is to have a boolean function of checking if there are duplicates in the array. Inside of that function, a for which goes from 0 to array size. So it would take as parameters an array and an int containing its size, and the element …

Member Avatar for Lucaci Andrew
0
2K
Member Avatar for Lucaci Andrew

Has anyone notice how much members we got on daniweb? Mine currently shows 1,004,528 members. Anyway, it's a great deal to have 1000000 members on a website. Keep it going Daniweb. :D

Member Avatar for happygeek
0
166
Member Avatar for happygeek

Indeed, at replying to a thread, when trying to upload a `.cpp` file it yels the following error: `The filetype you are attempting to upload is not allowed.`

Member Avatar for Ancient Dragon
0
2K
Member Avatar for xxwikkixx

I would suggest using the [ifstream](http://www.cplusplus.com/reference/iostream/ifstream/) operator when working with files. If, and only if, your text file is filled with numbers, than you could do it like this: â—‹ take first number as min â—‹ start going through all the numbers from the file, comparing each number with your …

Member Avatar for xxwikkixx
0
1K
Member Avatar for Yanz.rojas

Well what product do you have? And what are the simptomes? Do you see your wireless light turning on? If you don't you could search google for some applications that will force start your wireless connection.

Member Avatar for Lucaci Andrew
0
60
Member Avatar for paidah

Well, to start you with, what is a loop? It's a task that is repeatedly done till one or more conditions are fullfilled. Examples of loops would be: while (condition){ //do stuff } or do{ //do stuff } while (condition) or for (beginning of condition ; end of condition ; …

Member Avatar for JamesCherrill
0
143
Member Avatar for Lucaci Andrew

Wouldn't be nice to have a daniweb application for iphone? I mean, for an easier access to the website. I don't know if this ideea was proposed before, but I would lile to know if you thought of such an application.

Member Avatar for Lucaci Andrew
0
465
Member Avatar for jongiambi

Try to get out the srand() part from that function. Srand() generates a seed for your rand() function, thus it should be put just 1 time in your program, most likely in your main function since it's the starting point of your program and it is called just 1 time. …

Member Avatar for KaeLL
0
439
Member Avatar for pendo826

Well you could do it like this: #include <cstdio> #include <iostream> using namespace std; int main(){ cout<<"\\\\: "; char c; cin.get(c); cin.ignore(); if (c!=' ' && !isdigit(c)){ cout<<"Ok: "<<c<<".\n"; } else cout<<"Not ok.\n"; return (0); } `cin.get(c)` will put just the first character from the input stream, even if you …

Member Avatar for Lucaci Andrew
0
198
Member Avatar for HunainHafeez

use what **WolfPack** told you: //class ....{ int acc() { return (account_number); } //etc. } Also uxi[i].user(acno,amount,pass); will be useles. I suggest you to use the [vector](http://www.cplusplus.com/reference/stl/vector/) class ftom std to store your objects. And, BTW, took me 5 minutes to see where the class ends, and where the main …

Member Avatar for HunainHafeez
0
186
Member Avatar for Mas49er

Well you'll need something to get the input from the user, and than to separate that input in parts that will be stored in the array. Say, if you need to insert grades, I'll recomand you a class in which you'll get the whole stream inserted by the user, as …

Member Avatar for richieking
0
241
Member Avatar for bdl365

You'll be needing 2 nested loops, each one to 9. If you analyze a bit the pattern you can see that it's a square with i=9 and j=9: i/j0 1 2 3 4 5 6 7 8 0 A - A 1 A - A 2 A - A 3 …

Member Avatar for WaltP
0
287
Member Avatar for kayceedude

And have you tried to solve this or you just want to be handed the answer? No one will do your homework because: 1. Probably they can spend their time doing something else. 2. THIS WILL NOT HELP YOU AT ALL. Programmers don't just appear after graduating a highschool or …

Member Avatar for kayceedude
0
95
Member Avatar for mangsmurf

Have you tried to do some thinking/coding? We can help you as long as you show us something. We don't do homerworks/lab assignments.

Member Avatar for Lucaci Andrew
0
50
Member Avatar for if10066

Here are some avaible information about this: check those libraries, maybe they come in handy to what you are trying to accomplish [Click Here](http://stackoverflow.com/questions/870460/java-is-there-a-good-natural-language-processing-library)

Member Avatar for Lucaci Andrew
0
170
Member Avatar for Albino

I'll go aswell with the stringstream methods. It's form the standard libraries, and it's not that hard to implement. Have a look at the link that **mike_2000_17** posted, you'll find everything you need there. If you fancy, you can use the [istringstream](http://www.cplusplus.com/reference/iostream/istringstream/) (which manipulates strings as input streams) or/with [ostringstream](http://www.cplusplus.com/reference/iostream/ostringstream/) …

Member Avatar for Lucaci Andrew
0
188
Member Avatar for wids101

I would suggest you do it with a string instead of that int as the chosen variable, in order to rule out possible errors. I also would suggest using a for loop, and inside of it to make your validation via the if-else clauses. Here's a quick example of how …

Member Avatar for wids101
0
392
Member Avatar for techyworld

You can insert the ascii in the file using a csi (comma separate items) method, like 100,101,102,103 than getting from the file, having the comma `,` as the delimiter and than converting to characters. It would probably suite you better.

Member Avatar for vegaseat
0
278
Member Avatar for hillman.chen

So you want to get a string in which you'll store random characters from the name, pet and birth date rite? I would suggest using instead of that `char name[max]` thing, strings, for an easy use. Also, I would get the input from the user, and than form a string …

Member Avatar for vijayan121
0
419
Member Avatar for subith86

Here's the link from wiki [Click Here](http://en.wikipedia.org/wiki/Knapsack_problem) Here's a good totorial on the knapsack problem using dynamic programming [Click Here](http://www.youtube.com/watch?v=EH6h7WA7sDw) maybe this approach would suite you better than the "hard coding" one.

Member Avatar for Lucaci Andrew
0
332

The End.