Posts
 
Reputation
Joined
Last Seen
Ranked #426
Strength to Increase Rep
+5
Strength to Decrease Rep
-1
100% Quality Score
Upvotes Received
3
Posts with Upvotes
2
Upvoting Members
3
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
3 Commented Posts
~14.5K People Reached
Favorite Forums
Favorite Tags
c++ x 32
java x 3
c x 1
Member Avatar for peter_budo

You can use a javax.swing.JFormattedTextField with a java.text.NumberFormat as the format. For example: [CODE]numberField = new JFormattedTextField(NumberFormat.getInstance());[/CODE]

Member Avatar for JamesCherrill
0
9K
Member Avatar for scarypajamas

When you build and run a project in Xcode, the executable is placed in the build/Debug (or build/Release) folder relative to the project directory.

Member Avatar for iamthwee
0
994
Member Avatar for Nemoticchigga

Perhaps your compiler decided to optimize the code by substituting the contents of the function for the function call as if the function were declared inline.

Member Avatar for Nemoticchigga
0
263
Member Avatar for hiddendragon

As this is C++, you can use STL functions to do the work for you: [CODE]#include <algorithm> #include <iostream> int main() { int array[] = { 2, 5, 8, 1, 4, 2 }; size_t array_size = 6; std::cout << "Largest element: "; std::cout << *std::max_element(array, array + array_size); std::cout << …

Member Avatar for titaniumdecoy
0
2K
Member Avatar for fmwyso

I learned Java as my first programming language by reading Beginning Java by Ivor Horton. The book weights in at over 1000 pages. I found that an encyclopedic tutorial is an excellent way to learn your first language. I also read Accelerated C++ by Koenig and Moo having heard that …

Member Avatar for Dave Sinkula
0
132
Member Avatar for kadajett

[QUOTE=ArkM;646400]Well, we see unable to work (unable to compile) code sceleton. What's your problem?[/QUOTE] Read the comments in the input function.

Member Avatar for iamthwee
0
99
Member Avatar for sohel08

There is no [i]operator[/i] for raising to powers in C++ similar to the ** operator in Python. You can do the multiplication or use the pow library function as suggested.

Member Avatar for titaniumdecoy
0
67
Member Avatar for SunshineLuvr

You are calling payroll::setvariables twice with 4 arguments, whereas the function definition specifies that it requires 7 arguments. In addition, you have not defined the function, only declared it.

Member Avatar for mitrmkar
1
577
Member Avatar for titaniumdecoy

Is there a difference, in terms of performance, between the two loops below? (myvec is type [icode]std::vector<int>[/icode].) [CODE]std::vector<int>::const_iterator pos; for (int i = 0; i < N; i++) { pos = myvec.begin(); // do something with pos }[/CODE] [CODE]for (int i = 0; i < N; i++) { std::vector<int>::const_iterator pos …

Member Avatar for Narue
0
143
Member Avatar for titaniumdecoy

I did some searching on this topic but couldn't find anything definitive. Are basic types automatically initialized to 0 in C++ when allocated via [icode]new[/icode]? For example, are all values of nums guaranteed to be 0 in the code below? [icode]int *nums = new int[10];[/icode]

Member Avatar for Narue
0
103
Member Avatar for CoolGamer48

You can use the [icode]std::noskipws[/icode] stream manipulator to alter the behavior of the stream. See [URL=http://www.cplusplus.com/reference/iostream/manipulators/noskipws.html]here[/URL].

Member Avatar for titaniumdecoy
0
104
Member Avatar for arun0107
Member Avatar for titaniumdecoy

The default copy constructor should work for the Polynomial class below because it does not contain any dynamic data types. However, when I create a new Polynomial via the copy constructor, it prints 0 for the value of each coefficient. How can I fix this? [CODE]#include <iostream> #include <vector> class …

Member Avatar for Duoas
0
136
Member Avatar for sarehu
Member Avatar for lil_panda

Alternatively you can use STL functions: [CODE]#include <string> #include <algorithm> ... std::string::iterator end_pos = std::remove(str.begin(), str.end(), '\'); str.erase(end_pos, str.end());[/CODE]

Member Avatar for titaniumdecoy
0
101
Member Avatar for gregorynoob

Like ruggedrat said, a breadth first search will suffice. Starting at M, mark each reachable node as distance 1; from those nodes, mark each reachable node [i]that has not already been visited[/i] as distance 2; etc: [CODE]##765# C###43 765432 6####1 54321M[/CODE] The shortest path is 8.

Member Avatar for gregorynoob
0
176
Member Avatar for titaniumdecoy

I have a template function as follows: template <typename T> int my_func(T& arg) T is expected to be of type map<T1, T2>. T1 is expected to be of a basic type (int, long, etc.) and T2 is expected to be of type vector<T1>/list<T1>/etc. I want to iterate over the contents …

Member Avatar for vijayan121
0
111
Member Avatar for titaniumdecoy

If I declare a struct node, is the following legal in C++? [icode]node nodes_array[vector.size()];[/icode] I know this is not legal in C. However, my C++ compiler does not complain. Is this only in recent versions of C++, or has this always been legal in C++?

Member Avatar for sarehu
0
96
Member Avatar for titaniumdecoy

I am writing a chess game to familiarize myself with the C++ language. I have a Board class which contains a 2D array of pointers to Piece objects. I want to implement Board::operator[] such that the following is possible: [CODE]Board b; Piece *p = b[0][0];[/CODE] I could just return a …

Member Avatar for titaniumdecoy
1
119
Member Avatar for wavyaquaeyes
Member Avatar for Dallos

An even better way to do this would be to create a Person class with the appropriate fields, and create a new class that implements Comparator for each desired sort order. See [URL=http://www.leepoint.net/notes-java/data/collections/comparators.html]here[/URL].

Member Avatar for titaniumdecoy
0
68