Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by toneewa …int MAX_BALLS = 50; public BallPanel(Ball[] balls) { b.addAll(Arrays.asList(balls)); timer = new Timer(delay, this); timer.start();… javax.swing.JFrame; public class Frame{ public static void main(String[] args) { JFrame frame = new JFrame( "Bouncing Balls… Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by toneewa …int MAX_BALLS = 50; public BallPanel(Ball[] balls) { b.addAll(Arrays.asList(balls)); timer = new Timer(delay, this); timer.start();….swing.JFrame; public class Frame { public static void main(String[] args) { JFrame frame = new JFrame("Bouncing Balls… Re: String Arrays Programming Software Development by vmanes … length of the longest word, in order to allocate the string arrays, before storing the individual words. Be sure to place null… Defining string arrays outside of their class Programming Software Development by sindorei …been having trouble with this theoretical issue of defining string arrays (and even integers!) outside of their class. Here…> #include <string> using namespace std; class desu { public: string ok[4]; // Give string 4 elements of space … make sure that I'm not screwing up with string arrays) and i still get compile errors, eg: [… Trying to figure out how to change a couple string Arrays to Boolean arrays.. Programming Software Development by hemmysoft … is Java. Anyway, I have been trying to change two String arrays to Boolean's. I keep getting errors all the time…] = "first"; //Create the Second Class Array String class2Array[]; class2Array = new String[4]; //Put the desired data for each cell. class2Array… Re: Defining string arrays outside of their class Programming Software Development by sindorei Ah, okay, thanks. I was under the impression that the bracket usage in defining string arrays was simply a shorthand for manual initializing them one by one (ie, interchangable). String arrays Programming Software Development by ShadowScripter …give you an example using Char arrays (having two dimensional since it's not like string) [CODE=cpp]char arrChar[][…null-terminated I approached the problem like so: [CODE=cpp]string arrString[] = { "I Like Turtles", &… here is the actual code: [CODE=cpp]int CountStructure(string *structure){ int counter = 0; for(int i =… Re: String arrays Programming Software Development by Narue … array in bytes. Since std::string uses dynamic memory for the string contents, the size of each string object will be consistent, just… as if you used an array of pointers to char instead of arrays of… Re: String arrays Programming Software Development by siddhant3s … use them: [code=cpp] int main(){ std::vector<std::string> vec1; vec1.push_back("Hello"); vec1.push_back("…);//see definition below } void f1(const std::vector<std::string> & vec) //a function taking vector as argument { for… String Arrays Programming Software Development by matt91turbo … to start this program. I know how to create a string array, but I'm having trouble getting the overall structure… order, reverse order and backwards. Without using any C++ library string functions, print the number of letters in each word. Also… Re: String Arrays Programming Software Development by MosaicFuneral Everything for using C-style strings is in string.h Here's a reference: [url]http://www.cplusplus.com/reference/clibrary/cstring/[/url] Re: crack a cipher with string arrays Programming Software Development by Salem [url]http://cboard.cprogramming.com/cplusplus-programming/119344-crack-cipher-string-arrays.html[/url] Here's a FAQ [url]http://www.catb.org/~esr/faqs/smart-questions.html#forum[/url] Re: string arrays: storing input Programming Software Development by rem0404 … elements in the arrays const int MAX_SIZE = 100; /**** Function prototypes ****/ // Function: print // Parameters: // Functionality: void print(string[], int); // …: // Function: addMessage // Parameters: // Functionality: void addMessage(string[], int[], int, string, int); // Preconditions: int main() // Begin of main … Re: string arrays: storing input Programming Software Development by rem0404 … of elements in the arrays const int MAX_SIZE = 100; /**** Function prototypes ****/ // Function: print // Parameters: // Functionality: void print(string[], int); // Preconditions: … because we havent covered it yet: save void save(string file_in, string messages_in[], int keys_in[], int numElements_in) { // Declaring a… Arrays and Methods Programming Software Development by loupgarou … other "capitals". I have to fill both these String arrays using [B][U]ONE[/U][/B] method. I can handle…'s the capital...and so on. Do I create the arrays in the main method and pass them to readArray as… parameters? Or do I create the arrays inside of the readArray? I am completely lost with this… string arrays: storing input Programming Software Development by rem0404 … load function i have currently: [CODE]void load(string messages[], int keys[], int& numElements) { …int index = 0; int key; string message; while(index < MAX_SIZE && key … arrays. here's the addMessage function: [CODE]void addMessage(string messages[], int keys[], int numElements, string Re: string arrays: storing input Programming Software Development by Ancient Dragon >>are you saying i need to make numElements a call by reference parameter yes -- see below [code]void addMessage(string messages[], int keys[], [color=red]int& [/color]numElements, string message, int key) { [/code] you don't have to change load() at all. Re: string arrays: storing input Programming Software Development by rem0404 …[], int keys[], int& numElements) { int index = 0; int key; string message; while(index < MAX_SIZE && key > 0… Re: string arrays: storing input Programming Software Development by Ancient Dragon This is what I mean. [code] void load(string messages[], int keys[], int& numElements) { int index = 0; int …key [color=red] = 1[/color]; string message; while(index < MAX_SIZE && key > 0… String arrays error Programming Software Development by khanthegamer … by the definition(or maybe by the initialisation of the string array). The error is comin in the vending.cpp file… quantity; public: vendingM(void); void displayList(); int quantityOfProducts(); void getItem(string ); ~vendingM(void); }; #endif VENDING_HEADERer file [B]vending.cpp //cpp file… String arrays and the Scanner class Programming Software Development by Pobunjenik …java.util.Scanner; public class Fakultet { public static void main(String[] args) { Scanner input = new Scanner(System.in); …grades = new int[theStudent.subjectNum]; theStudent.subjectNames = new String[theStudent.subjectNum]; for (int i=0; i<theStudent.… Re: String arrays and the Scanner class Programming Software Development by JamesCherrill Parse: take some data in the form of a string and convert it into an integer or whatever. Java provides …standard ,methods for doing that, eg `Integer.parseInt(String s)` takes a string and interprets it as an integer, and returns that… Re: String arrays and the Scanner class Programming Software Development by JamesCherrill … takes everything up to the end of line, is a string of zero length. You need to take or skip the… Re: String arrays and the Scanner class Programming Software Development by Pobunjenik Acording to the pros, much like this: String parseFromThis = ""; for (int i=0; i<theStudent.… Re: String arrays and the Scanner class Programming Software Development by JamesCherrill Yes, the second version is OK too - it's the one I would use because it's clearer than the version with the extra String variable Re: Defining string arrays outside of their class Programming Software Development by William Hemsworth …like that, otherwise you have to assign the string to each array element seperatly like this:[CODE=…<iostream> #include <string> using namespace std; class desu { public: string ok[4]; } s; int main()… <iostream> #include <string> using namespace std; int main() { string ok[4] = {"one",… Re: Trying to figure out how to change a couple string Arrays to Boolean arrays.. Programming Software Development by jwenting …. Now to your question, you cannot cast an array of String to an array of boolean. They're unrelated types. You…'ll have to go through each String in that String array, determine whether it represents true or false, and… Re: Trying to figure out how to change a couple string Arrays to Boolean arrays.. Programming Software Development by hemmysoft … requires commenting of everything! I need to CHANGE the String's all the Booleans. When I substitute the Strings …Now to your question, you cannot cast an array of String to an array of boolean. They're unrelated types. …You'll have to go through each String in that String array, determine whether it represents true or false, … Re: Defining string arrays outside of their class Programming Software Development by sindorei … examples do work for integers perfectly. I tried initializing that string array, in main().. however, it brought up more errors. Here…: [CODE]#include <iostream> #include <string> using namespace std; class desu { public: string ok[4]; } s; int main() { s… Re: String arrays Programming Software Development by ShadowScripter Ah, thank you for the thorough explanations and examples Narue! siddhant3s, I don't know much about vectors, do you by any chance have a good link for a tutorial on them?