Good morning everyone, The library will be home, 0800 till 2100. I've been working on trying my loops in my hailstone sequence into recursions. It seem recursion can easrier to do, instead of creating loops. I say seem, because now I have come to halt on my progress. The halt is in the form of my sequence_Max function: /* //sequence_Max(int n) //Returns the largest value in the //hailstone sequence starting at 'n'. */ int sequence_Max(int n) { //Variable Declaration. int max = n, temp = n; while (temp > 1) { temp = next(temp); if(temp > max) { max = …

Member Avatar
Member Avatar
+0 forum 29

For My basic programming are using python. I want to create a game called rocket race where two rockets are racing side by side dodging meteroids. I just need some help knowing where to start. I made the rockets and the meteroids in paint already. So could you give me any code to start with? -Thanks, Bungie

Member Avatar
Member Avatar
+0 forum 1

I have this assignment to do. Its been about a year since I messed with c++ and I've been refreshing my brain on the subject. The assignment is this : Your assignment is to write a program for a computer dating service. Each client gives you his or her name, phone number, and a list of interests. It is your job to maintain lists of men and women using the service and to match up the compatible couples. You will find more details about the assignment, including the inputs, outputs, and deliverables in the course environment. Input Data about current …

Member Avatar
Member Avatar
+0 forum 10

I need help with my code for computers, our final assignment is to make a simple game, so I decided to do Hangman. This assignment is worth 20% of my final mark due on Monday so if anybody could help me with it I would really appreciate it. (I'm still in high school and its just basic programming, so the code doesn't really need to be fancy as long as it works properly). The only thing I got to work were the lines, then everything else is just a huge mess. [ICODE] class hangMan { public static void main (String[] …

Member Avatar
Member Avatar
+0 forum 8

...so I'm trying to make a program that takes in the three sides of a triangle and then decides whether the triangle is equilateral, isosceles or equilateral. I have to have 2 different functions and I can't use global variables ( That's what my teacher wants ). My main function keeps looping which is not what i want my program to do. I couldn't find what im doing wrong. Any help is appreciated. P.S. I don't use dev C++ anymore. I've started using Code::Blocks. Here's my code- [CODE] #include <cstdlib> #include <iostream> using namespace std; int calculations(); int main(){ int …

Member Avatar
Member Avatar
+0 forum 5

My text file is delimited (2 fields (text & numeric)). I'm trying to get the output into columnar format and include a count of the # of records following the columnar format. My text file is separated by commas. So far I can only read the text file. Here is [CODE]namespace ConsoleApplication5 { public class Class1 { static void Main(string[] args) { String line; { //Pass the file path and file name to the StreamReader constructor StreamReader sr = new StreamReader("data.txt"); //Read the first line of text line = sr.ReadLine(); //Continue to read until you reach end of file while …

Member Avatar
Member Avatar
+0 forum 14

I am writing a chutes and ladders game for a class, and it's mostly working but I can't figure out how to make the chutes and ladders work. Can I please have some hints? [CODE] board = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, …

Member Avatar
Member Avatar
+0 forum 1

Hey everyone! So, I'm making a hangman game. I'm at the very beginning stages so I just have a String array and just to make sure it works correctly I want to print a random word from the array - simple, right? I am running into an error - the output is below. I would be so happy if you guys could help!!! here is the code - and yes Hangman2 is the correct name. import java.util.*; public class Hangman2 { public static void main(String [] args){ Random random = new Random(); int rgen = random.nextInt(10)+1; System.out.println(rgen); //print random to …

Member Avatar
Member Avatar
+0 forum 1

I'm writing a program for a class that's a game. It has ten places to put a peg, numbered 1-10. You have to roll 2 die and the summation is the number you have to work with to try and fill in the board. So far, my program is as follows, but it's not working and if you have any hints then I would really appreciate it: import random #Global Constants PEG_HOLE = 10 Pegged = "X" list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] #Functions #Rolls 2 six sided dice and returns sum def roll_die(): …

Member Avatar
Member Avatar
+0 forum 6

Alright, so I've spent countless hours on this code and I need a fresh pair of eyes to give it a glance... This is my third assignment for my datastructures class, where I am to write code that turns a fully parenthesized expression (such as "((3+2)/(3-8))") into aan "arithemtic expression tree", where the internal nodes are operators and the external nodes are operands. The following function that I have written contains a logic error somewhere I suppose, because it simply crashes when I call it. My approach uses recursion, and the function contains parameters to pass the expression (in string …

Member Avatar
Member Avatar
+0 forum 3

Ok so this code works great with an if else statement but i dont why when i change the showMenu to a switch statement you cannot see my print out statement as a menu!? Iv tried different ways of writing the print outs and they havent worked at all. Also my public void forward statement keeps going up to 9 then wraps back to one when it should only stop at 8 then wrap back to one. is my logic wrong? the public int forward works fine and goes only up to 8 and wraps back to 1 thanks christine …

Member Avatar
Member Avatar
+0 forum 2

Imagine a tollbooth at a bridge car passing by the booth is expected to apply a fifty-cent tool. Mostly they do, but sometime a car goes by without paying. The tollbooth keeps track of the number of cars that have gone by and of the total amount of money collected. Model this tollbooth with a class called tollbooth. The two data items are a type-unsigned int to hold the total number of cars, and a type double to hold the total amount of money collected. A constructor initializes both these to 0. A member function called payingcar increments the car …

Member Avatar
Member Avatar
+0 forum 1

Hello, I am a female computer science student, and I would like for someone to please review my flowchart for Flipping a Coin to see if it makes sense or check if I made any errors. [URL="http://i52.tinypic.com/24fgq6f.jpg"]http://i52.tinypic.com/24fgq6f.jpg[/URL] Also, if anyone could please help me get started on the pseudocode, because I seriously draw a blank when I look at flowcharts on what identifiers to use, etc. Any help is much appreciated, thank you.

Member Avatar
Member Avatar
+0 forum 1

I have a scenario where i am given a file that contains info such as: (just a sample) img01.jpg|Washington DC|aquarium|puffer fish|seahorse img02.jpg|CHICAGO|AQUARIUM img03.jpg|Chicago|fish where the first section is the "image" (just a made-up name, not an actual image) and the rest of the words are keywords. ive been able to separate the file fine, but part of the assignment is to have to user enter a keyword and have all "images" with those keywords be listed. i am confused on which way i should store these words. i need to have something that can link a keyword with the "image". …

Member Avatar
Member Avatar
+0 forum 3

Hello. im a student working in C++ and im fairly new to both C++ and i guess this community.(i was reccomended to come here if i had problems) im just doing some simple exercises or s it seemed. here is the question. Write a C++ program with a case structure. The program reads in a character from the user, then translates it into a different character according to the following rules: i. characters X, Y, Z will be translated to characters x, y, z respectively ii. the space character ' ' will be translated to underscore '_' iii. digits 0, …

Member Avatar
Member Avatar
+0 forum 7

I already have an infix to postfix converter, now I want to get the answer from the postfix notation. Here is my code to evaluate a given postfix notation and (hopefully) get the answer: [CODE=java] public class testEVAL { private StackArray SA; private String input; private int postfixEVAL; //start constructor public testEVAL(String input){ SA = new StackArray(); this.input = input; //postfixEVAL =; }//end constructor private int obj2intCONVERT(Object obj){ return Integer.parseInt(obj.toString()); }// converting popped Objects into Integers //start operation methods private int add(int a,int b){ return a+b; } private int sub(int a,int b){ return a-b; } private int mul(int a,int b){ …

Member Avatar
Member Avatar
+0 forum 2

I have finished editing the program but I still have a couple of errors that I can't figure out, please help Errors: Error 1 error C2601: 'split' : local function definitions are illegal \\ilabss\home$\D03279277\Documents\Visual Studio 2005\Projects\err\err\err.cpp 97 Error 2 fatal error C1075: end of file found before the left brace '{' at '.\err.cpp(82)' was matched \\ilabss\home$\D03279277\Documents\Visual Studio 2005\Projects\err\err\err.cpp 137 [CODE]/* Specification: Gilberto Sotomayor-Candelaria Lab 7 Exercise 3 Append and display records in a address database*/ #include <iostream> #include <fstream> #include <string> using namespace std; void menu(void); void writeData(void); void readData(void); string * split(string, char); const char FileName[] = "c:/TestAddress.txt"; int …

Member Avatar
Member Avatar
+0 forum 3

I have this code and I am having trouble figuring how to make it run without any errors, can anybody give me some pointers on how to fix it [CODE]#include <iostream> #include <string> #include <iomanip> using namespace std; class TicTacToe { private: char theBoard [3][3]; public: TicTacToe(void); void playOneGame(void); void switchPlayer(char &); void showBoard(void); void postMove(int, int, char); char determineWinner(void); }; int main (void) { //test the class by playing one game TicTacToe Game1; Game1.playOneGame(); return 0; } void TicTacToe::playOneGame(void) { //start a game and play until someone wins or a draw occurs... const int MaxMoves = 9; char currentPlayer …

Member Avatar
Member Avatar
+0 forum 4

Hey can someone please tell me what kind of variables i should use when making a class mark program ? thanks :)

Member Avatar
Member Avatar
+0 forum 4

I have to finish the code but I am having several errors with this and I can't figure it out can somebody give me some insight on what I can do to fix this and also explain what am I doing wrong. Here are the errors I am getting Error 1 error C2065: 'amno' : undeclared identifier \\ilabss\home$\D03279277\Documents\Visual Studio 2005\Projects\Lab5Ex1\Lab5Ex1\Lab5Ex1.cpp 22 Error 2 error C2065: 'safetyOn' : undeclared identifier \\ilabss\home$\D03279277\Documents\Visual Studio 2005\Projects\Lab5Ex1\Lab5Ex1\Lab5Ex1.cpp 25 Error 3 error C2065: 'maxAmmo' : undeclared identifier \\ilabss\home$\D03279277\Documents\Visual Studio 2005\Projects\Lab5Ex1\Lab5Ex1\Lab5Ex1.cpp 26 Error 4 error C2143: syntax error : missing ';' before '.' \\ilabss\home$\D03279277\Documents\Visual Studio 2005\Projects\Lab5Ex1\Lab5Ex1\Lab5Ex1.cpp 43 …

Member Avatar
Member Avatar
+0 forum 1

hello guys, Can any of you help me create a game in java?? There has to be two paddles, one at the top and the other at the bottom. The paddles have to stop the ball from getting out of the screen. The ball cannot leave the screen from the left or the right. Can you please help me?? Thanks.

Member Avatar
Member Avatar
+0 forum 4

[CODE]#include <iostream> #include <cstdio> #include <iomanip> #include <cstdlib> #include <ctime> using namespace std; int main() { int rNumber = 0; int uNumber = 0; const int maxNum = 10; const int minNum = 1; const int range = maxNum - minNum; int counter = 0; //declare random formula srand((unsigned int)time(NULL)); rNumber = 1 + rand() % (range + 1); cout << "Welcome To The Guessing Game!\n"; //goes infinite until the right number is selected or they select -1 do{ while(uNumber != rNumber || uNumber != -1) { cout << "Please Select A Number From 1 Through 10 To See If …

Member Avatar
Member Avatar
+0 forum 3

I am having trouble getting my program to run. I can't figure out where this error is...prob. something easy and i'm just to tired to find it. Anyways here is the project details and the c++ code that I have wrote is attached below since I haven't messed with the code wrap yet. If there are any suggestions on how I can make the program easier pls tell me your 2 cents. error: 56: ) expected in function main() I counted and couldn't find where i left a ")" off if someone would show me another way to write the …

Member Avatar
Member Avatar
+0 forum 2

Hello, my name is johnhee. I want some help to make code mathlab programming. My program is related with Digital System Progressing. um, My programming content is.. If I input my voice record using wavrecord funtion, my voice is filtered by ideal LPF(low pass filter) , HPF(high pass filter). I make LPF function and HPF function. (not usinf fft funtion in mathlab). but I can't make LPF function and HPF function. (so hard).. help me plz... Initial condition is nothing.. um One is sampling frequency is 8192 in 1 second.

Member Avatar
+0 forum 0

Write a program that reads in a sentence of up to 100 characters and outputs the sentence with spacing corrected and with letters corrected for capitalization. In other words, in the output sentence, all strings of two or more blanks should be compressed to a single blank. I don't know how to compress multiple blank spaces to one blank space. But my other functions work. Please help me with my deleteSpaces function! [CODE] #include <iostream> #include <cstdlib> #include <cctype> using namespace std; /**************************************************************************** Program: Ch8-1 Purpose: Fix sentences. ****************************************************************************/ const int MAX = 101; void clearPhrase(char p[], int &size); void …

Member Avatar
Member Avatar
+0 forum 2

i have an assignment due for my c++ class where we have to input from the keyboard the quantity and input from the keyboard the stock price. so that it outputs as: Stock Item Quantity Unit Price Total Value ---------------------------------------------- Television 5 368.00 1840.00 Video Recorder 8 268.00 2144.00 Camera 9 300.00 2700.00 DVD 10 468.00 4680.00 Hi Fi Stereo 13 2500.00 32500.00 Video CD 25 345.00 8625.00 ---------------------------------------------- Gross Total: 52489.00 this is the code i have so far. i know i need to declare everything but i don't know how or where i should put it if any …

Member Avatar
Member Avatar
+0 forum 14

I really need help in some parts of my minesweeper code using Tkinter. I don´t have much experience in python and I am facing two major problems that I just can´t solve. The first one is that, as I generate buttons dynamically, they all have the same name and receive the same variable in the textvar option. Because of that I am not able to change the image presented on the button. The only button I am able to change this way is the last one, obviously wrong... The other problem is that i am not finding a way to …

Member Avatar
Member Avatar
+0 forum 2

[CODE] //************************************************************************************ //function playagain(); //parameters char cAns //resets game variables and board or exits game //************************************************************************************ void playagain(char cAns) { cout<<"would you like to play again?(y/n)"<<endl;//function call depending of the choice of the player cin>>cAns;//sts value to variable do { iTotalMoves=0;//resets # of moves ResetBoard();//resets game array cPlayerSymbol='a';//resets game char (so that function will ask the player X or O again) symbol(); // ask the player's symbol then calls the game function } while(cAns=='y' || 'Y');//but no matter what I type (as long as it's not y or Y, it loops into the game again return(0); }[/CODE] it's not exiting, …

Member Avatar
Member Avatar
+0 forum 4

In this program we are going to simulate a simple card game. The rules are that the player selects a card out of a deck of 52 cards. The computer picks a random card out of the deck. The person with the highest card face number wins. In this program it would be very helpful to use the examples of card games in the book. This will give you a majority of the code to setup this program. Then you need to add your own classes and code. You must have 2 classes in your program. One class will be …

Member Avatar
Member Avatar
+0 forum 36

this snippet below is my code. It's supposed to be a memory game, but i have some problems making it work, I've made a button_1 that generates 6 random numbers in random order, those 6 numbers are supposed to tell the "p1 - p6" (pictures (2 of each to make pairs)) what picture boxes, they're getting in to, I'd really like it to be random what pictures, goes into the picture boxes. problems i have: 1. random numbers cant get into the array "R[6]" and then i cant use it down in the "pictureboxes" to get assigned to a picture. …

Member Avatar
Member Avatar
+0 forum 3

The End.