527 Posted Topics

Member Avatar for vladdy191

Have you tried providing a .txt extension in the String name of test? [icode] // Open an input stream stream = new FileInputStream ("test.txt"); [/icode]

Member Avatar for destin
0
446
Member Avatar for lightzoutdeuce

Whip up some code? Give me a break X_X You should try putting in some effort, then we might help! =)

Member Avatar for lightzoutdeuce
0
59
Member Avatar for Richy321

You can take advantage of a Ternary statement by doing a comparison and returning a value based on the condition, all on the same line. [code=c++] #include <iostream> using std::cin; using std::cout; using std::endl; using std::flush; const char* result(bool); int main(){ int x = 3; int y = 4; cout …

Member Avatar for Richy321
0
132
Member Avatar for Levio91

You should probably sift around on google, and especially wikipedia to answer those questions. [URL="http://en.wikipedia.org/wiki/Programming"]Programming[/URL] [URL="http://en.wikipedia.org/wiki/C_Programming"]C Programming Language[/URL] [URL="http://en.wikipedia.org/wiki/Forth_(programming_language)"]Forth[/URL] [URL="http://en.wikipedia.org/wiki/Compiler"]Compiler[/URL] -Alex

Member Avatar for freudian_slip
0
141
Member Avatar for Nasi23

First of all... when posting something like this, you should be explicit as to what type of errors you're getting. It will help for faster problem analysis and problem solving. Second, please indent your code so it's easier to follow. Lastly, it does help to tell us what compiler you're …

Member Avatar for Alex Edwards
0
138
Member Avatar for phalaris_trip

[url]http://java.sun.com/javase/6/docs/api/java/math/BigInteger.html[/url] [code=java] import java.math.BigInteger; public class TestingBigInteger{ public static void main(String... args){ BigInteger first = new BigInteger("50"); BigInteger second = new BigInteger(first.toString()); System.out.println(first); System.out.println(second); } } [/code] Have fun! =)

Member Avatar for destin
0
1K
Member Avatar for andrewama

SIZE might be a defined macro for something, so try to undefine it-- [code=c++] #include<iostream> using std::cout; using std::endl; #ifdef SIZE #undef SIZE #endif const SIZE= 101;//0 to 100 set containing 101 elements // ... [/code] EDIT: Scratch that. You forgot to declare a storage type for SIZE. It's const, …

Member Avatar for grumpier
0
170
Member Avatar for afg_91320

[QUOTE=afg_91320;726452][code] int array1[4], array2[4] = {3, 6, 9, 12}; array1 = array2; [/code] and this one: [code] void showValues (int nums [4][]) { for (rows = 0; rows < 4; rows++) for (cols = 0; cols < 5; cols++) // is this the line of error? cols is not declared …

Member Avatar for Alex Edwards
0
556
Member Avatar for haven_u

Have you tried copying your Queue into a temporary Queue, and printing the data of the temporary Queue instead?

Member Avatar for Prabakar
0
93
Member Avatar for DragonReborn225

Here's something I managed to whip up thanks to your logic-- [code=c++] #include <iostream> #include <string> #include <vector> using std::cout; using std::cin; using std::endl; using std::flush; using std::string; using std::vector; bool isPalindrome(const string&); const char* result(bool); int main(){ vector<string> values; values.push_back("mom"); values.push_back("ffaff"); values.push_back("dad"); values.push_back("nonPalindrome"); values.push_back("blah"); values.push_back("A"); values.push_back(""); for(vector<string>::iterator i = …

Member Avatar for vmanes
0
182
Member Avatar for aksshe10

[url]http://www.sscnet.ucla.edu/geog/gessler/borland/strings.htm[/url] Also [icode] "LPCTSTR" or "LPTSTR" [/icode] Looks like 'Long Pointer (const) to String' and 'Long Pointer to String' Since CreateProcess is defined in windows.h, I'd assume that STR is referring to a char*, or c-style string. You could create your own custom method for converting an AnsiString into a …

Member Avatar for Alex Edwards
0
210
Member Avatar for DemonGal711

I thought I had the specs right until you said down-right instead of up-right in your 2nd paragraph. Maybe a picture will be helpful? Also, what are you using to graphically display your program? Is it a Console program or are you using some kind of GUI API? This question …

Member Avatar for stilllearning
0
130
Member Avatar for Alex Edwards

This makes me slightly curious... Why is there assembly code for the string class of C++? [code=asm] page ,132 title strlen - return the length of a null-terminated string ;*** ;strlen.asm - contains strlen() routine ; ; Copyright (c) Microsoft Corporation. All rights reserved. ; ;Purpose: ; strlen returns the …

Member Avatar for ddanbe
0
1K
Member Avatar for lordx78

I love wikipedia-- [url]http://en.wikipedia.org/wiki/Genetic_algorithm[/url] --then again that may be too broad. What is your trouble exactly? Coding the Algorithm or understanding it? If you understand Java you can probably code this by understanding the concepts of the Algorithm. If you understand the Algorithm then try coding it and come back …

Member Avatar for dickersonka
0
132
Member Avatar for Xarver

Note: I'm not near a C++ compiler, but hopefully the below logic will be helpful to you. Create an interface that has two options for every subclass of its type-- [code=c++] class DoSomething{ public: DoSomething(){} virtual void option1() const = 0; virtual void option2() const = 0; }; [/code] -- …

Member Avatar for Xarver
0
148
Member Avatar for liquoriser21

Programming is my passion =) I want to die typing at the keyboard trying to solve problems and improve my ability of insight =) I want my life to be absorbed by programming, because I used to write stories and also had a knack for mathematical problems. I tried putting …

Member Avatar for vegaseat
0
239
Member Avatar for Alex Edwards

How many of you carry your Credit card on you when you walk out the door? (It's a survey I have to do for a class %_%) I'm also going to do an offline survey, but the online survey is just as important! =) -Alex

Member Avatar for Alex Edwards
0
158
Member Avatar for joshmo

[QUOTE=joshmo;719319]the variable q is not declared in the class A and I dont want to declare it. Is there anyway this can be done? I tried that and it says "non-static variable cannot be referenced from a static context" If also someone could share with me what this means. Thanks …

Member Avatar for BestJewSinceJC
0
104
Member Avatar for seanhunt

Templated classes denote incomplete types and you can specialize a particular case to have a completely different definition than the general case. What's the guarantee that long double isn't a specialized case in the vector class that doesn't have an inner iterator class? I'm not sure when it is resolved …

Member Avatar for seanhunt
0
128
Member Avatar for JustLearning

[code=c++] template<class SomeType> void TemplateQ<SomeType>::Enqueue(SomeType newData) { if (IsFull()) throw FullTemplateQ(); else if(IsEmpty()) { QueueNode<SomeType>* nextQueueLocation; nextQueueLocation = new QueueNode<SomeType>; nextQueueLocation->data = newData; nextQueueLocation->nextPtr = NULL; if(rearPtr == NULL) frontPtr = nextQueueLocation; else rearPtr->nextPtr = nextQueueLocation; rearPtr = nextQueueLocation; } } [/code] I'm not quite sure how you want your …

Member Avatar for JustLearning
0
185
Member Avatar for animefun2

[QUOTE=animefun2;717932]Ive been looking for the right compiler that i can use with java applet to create an online game so does any one know the best compiler for java applet? and where i can find it in a free download from a website? or a list of compilers that i …

Member Avatar for jbennet
0
207
Member Avatar for chococrack

[QUOTE=chococrack;718917][B][COLOR="Green"]SOLUTION:[/COLOR][/B] TWO files: myClass.h main.cpp [code=C++] // // myClass.h #ifndef MYCLASS_H_ #define MYCLASS_H_ template <class element_type> class myClass { public: myClass(); ~myClass(); }; template <class element_type> myClass<element_type>::myClass() { } template <class element_type> myClass<element_type>::~myClass() { } #endif /* MYCLASS_H_ */ [/code] [code=C++] // // main.cpp #include "myClass.h" int main() { myClass<int> …

Member Avatar for Alex Edwards
0
188
Member Avatar for kenji

[QUOTE=kenji;718360]Well I read both the links and have a better idea about them. Iv updated my code as well but I get an error which basically says that it can't find the prototype or the variable being returned. [code=CPLUSPLUS] const char Account::*getData() const{ return data; } [/code][/QUOTE] Post all of …

Member Avatar for seanhunt
0
158
Member Avatar for guest7

Warning! O_O Delete does not really delete! Delete frees dynamically-requested memory that the C++ program obtained from the OS at run-time. Delete does NOT actually delete anything! Do not use it freely, unless you really want to screw up your program or cause your OS to flag an error to …

Member Avatar for Ancient Dragon
0
127
Member Avatar for guest7

[QUOTE=Sci@phy;718207]Umm, your code?[/QUOTE] Exactly my thoughts. From what I understand, malloc can fail if you've run out of heap-space your program is using for dynamic allocation or if you are attempting to allocate memory to a location that is in use by another process. [icode]size=2097152[/icode] Your heap should be (by …

Member Avatar for guest7
0
190
Member Avatar for massivefermion

[QUOTE=dmanw100;717946]In otherwords there isn't a way to easily make your own character in C++[/QUOTE] That seems like the truth! Especially since C++ is just a tool that interfaces with other systems, I suppose there's no direct way c++ itself could create a character the system would recognize! It would probably …

Member Avatar for Alex Edwards
0
136
Member Avatar for joshmo

[QUOTE=joshmo;717762]That is not it. I want A to be able to use a method in B..Is that possible[/QUOTE] I think Object creation might shed some light on this issue... If you create an Object of type A, A is at least of its class and additionally any other class it …

Member Avatar for Alex Edwards
0
144
Member Avatar for ruby T.

[QUOTE=ruby T.;717028]i didn't ask anyone to do the whole thing .. wat i wanted is if anyone had sth similar to wat i need he/she cld share with me so i cld have an idea abt it ... cuz i already started working on it and i got stuck in …

Member Avatar for peter_budo
0
179
Member Avatar for nitric0

[code=java] // ... System.out.println(" Beverage Number of Votes Percentage"); System.out.println("-------------------------------------------------------------------------------------"); System.out.println(); System.out.println("Coffee "+choice1+ " "+perc1); System.out.println("Tea "+choice2+" "+perc2); System.out.println("Orange Juice "+choice3+" "+perc3); System.out.println("Lemonade "+choice4+" "+perc4); [/code] Use tabs instead of trying to space things out and match them up manually =/

Member Avatar for Alex Edwards
0
123
Member Avatar for dimitrios67

An idea? Use JDBC to store book information then retrieve it later. Files are ok, but it might be easier to query necessary information than try to make a dozen different methods for obtaining books in certain order, or certain books period.

Member Avatar for stultuske
0
601
Member Avatar for JustLearning

It looks like you forgot to include your header file. Try adding this to the top of your script-- [code=c++] #include "templateq.h" [/code] Edit: Hmm interesting, I made the following changes and it managed to work-- [code=c++] //templateq.h #ifndef TEMPLATEQ_H #define TEMPLATEQ_H #include <iostream> #include <new> #include <cstddef> using namespace …

Member Avatar for Alex Edwards
0
146
Member Avatar for DemonGal711

Here's an example of encapsulating a 2D vector and emulating the behavior or a 2D vector through a class-- [code=c++] #include <iostream> #include <vector> #include <cmath> using std::cin; using std::cout; using std::endl; using std::vector; using std::ostream; using std::size_t; class TwoDimensional{ vector<int> dummyVec; vector< vector<int> > rowContent; public: TwoDimensional(unsigned int rowSize …

Member Avatar for DemonGal711
0
122
Member Avatar for sohamghosh

There are several ways... The most popular way would be to save the information to a file then retrieve it later. Another popular way that isn't done unless absolutely necessary is by querying information to a database then retrieving it later. There may be a way to fool around with …

Member Avatar for sidatra79
0
142
Member Avatar for PaladinHammer

In C++, you can declare a function, constructor, or operator to accept a type by reference and not value. For example, the declaration of the function-- [code=c++] void foo(int); [/code] --states that the function foo takes [a copy of] an integer and returns void. So the following would be legal-- …

Member Avatar for PaladinHammer
0
153
Member Avatar for lllllIllIlllI

[code=c++] void printmovie (movies_t movie); [/code] Is a function declaration. The definition exists elsewhere in the same file. Short/Simple reason: C++ can be very linear. If you comment out the function declaration, you will get a compiler error. That is because the function printmovie is found after the definition of …

Member Avatar for lllllIllIlllI
0
145
Member Avatar for Alex Edwards

I've recently started studying the Unified Modeling Language. I'm currently using an exam book as a study guide, because it presents features without holding back on information-representation at all. Afterward, I will study the book made by the first 3 who started developing UML (since OOPSLA/OOSE I believe, though I …

Member Avatar for sidatra79
0
162
Member Avatar for McCo

You may want to talk to williamhelmsworth or look up a C++ library that allows you to interface with your OS and export/import bitmaps from C++. Here's a code snippet from william that allows you to create .bmp's from C++, so I can imagine that importing would be a similar …

Member Avatar for Alex Edwards
0
100
Member Avatar for blade_costic

I strongly recommend learning PHP (or JSP) and Oracle together. Knowing how to design a Web page and manage a database can get you MANY jobs in the IT field, especially when integrating a Database to store information sent from forms in HTML processed requests. Knowing XHTML is also a …

Member Avatar for Narue
0
184
Member Avatar for clutchkiller

[QUOTE=clutchkiller;714471][Linker error] undefined reference to `add()' Can someone explain that a little? Do i need to include my code to help you guys explain? Thanks[/QUOTE] It never hurts to include your code (provided it's not too long! O_O). Just be sure to use code tags @_@ -Alex

Member Avatar for clutchkiller
0
67
Member Avatar for cakka

AD provides a good suggestion. In fact, learning anything that is .NET compatible (C#, C++, ADO, VB, J#, etc) is advantageous.

Member Avatar for robertek
0
202
Member Avatar for priti_s

[QUOTE=priti_s;713601]Hi I have come across a question in a collection which says: One can add a reference of a collection to itself. Is it true or false? I read the explanation that, we can add the reference to the collection to itself, but it results in the [U][B]stack overflow of …

Member Avatar for Ezzaral
0
121
Member Avatar for askhan

It might do you some good to learn RMI from the book Head First Java or get a brief overview by reading Head First Design Patterns. Both books are good and provide more information about programming and Object Orientation than one would expect. And also, both books are funny XP

Member Avatar for masijade
0
340
Member Avatar for DemonGal711

You can't make a typedef out of an incomplete type, so the following would be illegal if NodeType is generalized-- [code=c++] typedef NodeType* NodePtr; struct NodeType { ItemType item; NodePtr next; }; [/code] -- because templates of typedefs are illegal. You would need to alter your struct to have a …

Member Avatar for Alex Edwards
0
3K
Member Avatar for kittycat07us

[QUOTE=stilllearning;713564]Please put code tags around your code. Also, wouldn't it be easier to store the binary value you are computing in a string, inside your binary class ? And then just start at position starting point in the string and then scan for the next zero ?[/QUOTE] That would be …

Member Avatar for Alex Edwards
0
414
Member Avatar for VernonDozier

Bah, disregard this post >_< [code=java] public <T extends A> void doSomething(T type){ if(type instanceof [SpecialNeedClass]){ // typecast only for this type } // else if(...) // other specialized types else{ // if no other specialized type, perform basic A operations } } [/code] It would've been a good idea …

Member Avatar for VernonDozier
0
261
Member Avatar for Tyster

This managed to work for me-- [code=java] import java.util.*; public class TestClass1{ static String seatLayout = null; static String fn = null; public static void main(String... args){ System.out.println(showAllSeats("1294")); } public static String showAllSeats(String flightNumber){ fn = flightNumber; // Make a set of arrays for each flight. This is only one …

Member Avatar for Tyster
0
207
Member Avatar for Traicey

I think you will need assistance from a Regex library. Example (for unmanaged C++) [URL="http://www.boost.org/doc/libs/1_36_0/libs/regex/doc/html/boost_regex/introduction_and_overview.html"]here[/URL]

Member Avatar for Alex Edwards
0
61
Member Avatar for number87

I believe declarations and definitions are allowed outside main, but assignments are not. This example compiles fine-- [code=c++] #include <iostream> #include <ctime> #include <sstream> using std::cout; using std::cin; using std::endl; using std::ostream; using std::stringstream; ostream& operator << (ostream&, const tm&); tm mytime; // not quite safe int main(){ // tm …

Member Avatar for sidatra79
0
1K
Member Avatar for saneeha

Interesting that you want to use a format specifically meant for separating individual values with commas, but need to retain information with commas inside it. A good way of doing this would be to make your own tokenizer and only parse information when a stack is empty. When you encounter …

Member Avatar for Alex Edwards
0
79
Member Avatar for Alex Edwards

I tried implementing a template Array-class that allows initial size of global arrays to be known at compile time, specified by the user. When I specify a class of type <1, 1> size, the file compiles fine. However, when I specify a class of any other numeric type, in either …

Member Avatar for Alex Edwards
0
226

The End.