- Strength to Increase Rep
- +6
- Strength to Decrease Rep
- -1
- Upvotes Received
- 13
- Posts with Upvotes
- 9
- Upvoting Members
- 9
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
Re: This may be a sloppy method of doing so, but you can send a reference to the JTextPane that you are using and manipulate the Caret after you are done sending characters to the Document. [code=Java] import javax.swing.*; /** * Main frame for the program. * @author Bill * */ … | |
Re: [QUOTE=baconswife;1357002]I am writing a program that outputs whether or not a number is prime. Can anyone help me find where my syntax error is? Also, i get that i = 3; i <= num; i++ would be true for it being a prime number from the other forums I have … | |
Re: Edit: this was for the first page ;p Doesn't compile on VC++ 2010 | |
Re: That's why default-types exist. Consider the Map interface, it is declared as follows-- [code=c++] template < class Key, class T, class Compare = less<Key>, class Allocator = allocator<pair<const Key,T> > > class map; [/code] Notice how class Compare = less<Key> and class Allocator = allocator<pair<const Key, T>> That means, if … | |
My name... I'd rather not say. Intrade is fine. I would prefer to be referred as this name than my others anyways. I'm a very shy individual. I have a great need to become not just a good programmer, but a good Computer Scientist. I apologize for my past deeds … | |
Re: I am not that great with pseudocode, but this is a possible process. Basically you can use a map with string keys and int values to keep track of each sequence and if the same sequence is run into on the map, increment the value by 1-- [CODE=text] // Input: … | |
Re: *sigh* I didn't want to bother posting this because I'll probably get flamed, but maybe you can make use of it-- [code=c++] /** * Numerics.h */ #ifndef NUMERICS #define NUMERICS #include <sstream> #include <string> #include <iomanip> using namespace std; /** * Convenience class for enabling easy * conversions between strings … | |
Re: You forgot to prefix the functions with your classname... right now the compiler sees getWidth() and getLength() as functions declared/defined outside of your class that are independant of your class, so the variables W and L are searched for in global scope and not found-- [code=c++] //... // prefix getWidth … | |
Re: You need to add/initialize sum-- [code=c++] int sum = 0; [/code] -- and then change your code to accommodate one of your requirements -- [code=c++] #include <iostream> #include <iomanip> using namespace std; int main() { double firstNum, secondNum; // Operands char oper; // Operator int result; // Resulting value int … | |
Re: You're trying to compare a string with a char-- [code=c++] //... char humanChoice(){ //... } //... // declare variables string human; //... human = humanChoice(); // assignment, not construction - http://www.cplusplus.com/reference/string/string/operator=/ if (human == 'Q' || human == 'q') break; // doesnt work - string == char isn't defined [/code] … | |
Re: What exactly do you mean by updating? As in appending some information, incrementing the value of the char or how many times it is accessed? What exactly do you mean? And please use code-tags for your code- [CODE=c++] //...code [/CODE] | |
Re: Ancient Dragon, you always amaze me with your code. How do I hash this out on paper so I'm not stuck wondering how to format my output? How should I conceptualize the left/right/internal modifiers being used with setw? [url]http://www.cplusplus.com/reference/iostream/manipulators/left/[/url] From the code given, is it safe to assume that fill … | |
Hello guys! I'm trying to learn the Boost regex library for a more-convenient means of error-checking and the asio library to allow a fairly portable-means of manipulating data over TCP/IP. My goal is to retrieve the file information from a website (basically http layer). My first problem is determining the … | |
Re: Read "The C++ Programming Language" by Bjarne Stroustrup. | |
Re: I'm really curious about this, but where do you initialize the size of m_vParentPop2 (your DNA vector)? Just glancing at the code, I can only see that as the problem. I don't see anywhere where you've pushed DNA pointers into the vector before accessing its [] operator. I'm using TextPad … | |
Re: You can completely omit the need to place your chars into ints for display by simply adding 48 to all of your chars in your 2D char array-- [code=c++] int X; int O; char board[num_rows][num_colm] = {{1,2,3},{4,5,6},{7,8,9}}; cout << "TIC-TAC-Toe" << endl; for(int i=0; i < num_rows; i++) { for(int … | |
Re: [QUOTE=Mona..;1366850]hello.. What do we mean by binary search and how we can do it using C++ thanks..[/QUOTE] 1) [url]http://en.wikipedia.org/wiki/Binary_search_algorithm[/url] 2) [url]http://www.fredosaurus.com/notes-cpp/algorithms/searching/binarysearch.html[/url] I found these sources off of google. I really don't mean to sound mean, but before asking a question on a forum try exhausting other easy means of answering … | |
Re: How do you want people to access your 4D vector points? At first glance I'd think something like this would work for you-- [CODE] float operator [] (int index) { index = (index >= 0) ? ( (index <= 3) ? index : 3 ) : 0; switch(index){ case 0: … | |
Re: Is there a specific reason you're using iostream.h in the brackets? You typically omit the .h but you also forgot to declare the namespace you're working in. Lastly, the function that takes "Test" I believe takes a slightly bigger datatype than const char* try prefixing it with L-- [code=c++] //... … | |
I'm fairly new to Boost. I would like to use the Regex library. I wanted to follow this guide but it seems that it supports other versions of VC++. [url]http://www.boost.org/doc/libs/1_44_0/libs/regex/doc/html/boost_regex/install.html[/url] EDIT: I tried finding a link to VC++ 6.0 and I can't find it >_<, apparently Microsoft is no longer … | |
Re: Okay, how about this. Make a function that accepts an IP Address, and the Subnet (Subnet Address and Mask) and have it return a bool. It returns true if the IP Address exists in the subnet, or false if it doesn't. [code=c++] bool ValidIP(const string& ipAddress, const string& subnetAddress, const … | |
Re: How about writing some ideas on paper that you would like to personally code and then learn what you need to get the job done? Although this might seem daunting, it really pays off when you finish the project and you'll learn how to arrange your thoughts into Java code … | |
Re: If | Original Servings / Desired Servings | = rate then rate = 1 / | Desired Servings / Original Servings |, but you don't account for this in your code. [CODE] //modify -1 below to be your new calculated value. return (rate - 0.1 * (1 - (1/rate))); [/CODE] | |
Re: Maybe something like this will work? [code=c++] class a; class b; class a { b* bpointer; }; class b { a* apointer }; [/code] | |
What I want to know is if I can call a function defined in a C++ class in Visual Basic through a .dll generated from VC++2010? Is this possible, or do I need to define the .dll with C++ raw functions outside of a class? For example, my class looks … | |
Re: In what way do you want it to bounce? Up-and-down or around the screen, or some other implementation? If it's just around the screen, you can give the object velocity (some dx and some dy) where dx is the rate at which it travels along the horizontal (and its horizontal … | |
Re: You forgot to add return average to your function-- [code=c++] int calcAverage() { int sum=0; int average; int TESTVALS[5] = {2, 18, 1, 27, 16}; for(int i = 1; i < 5; i++) sum+= TESTVALS[i]; average= sum/5; return average; } [/code] -- so its possible that due to the lack … | |
Re: It looks good. Nobody else responded. I didn't want you to feel ignored ;p | |
Re: For your function addingarray, try using actual pointers for parameters... [code=c++] void addingarray( int* a, int* b, int* c, int size){ //... } [/code] Also you are trying to push a void function into the outputstream which I don't think the compiler will like. Omit that. In the function addingarray, … | |
Re: You could try having a mapping of strings to numbers and upon entering a string as the key the map returns the value as an integer that the day represents. |