Hello All, I am having trouble looping through a 2D array in C++ (should be very easy, but I am just starting C++). At the current moment I have this class file #include "Cube.h" #include <freeglut.h> #include <stdio.h> Cube::Cube(int cx, int cy, int cz , int cubeWidth) { int p[][3] = { { cx, cy, cz }, { cx, cy-cubeWidth, cz }, { cx + cubeWidth, cy - cubeWidth, cz },{cx + cubeWidth, cy, cz}, { cx, cy, cz - cubeWidth }, { cx, cy-cubeWidth, cz - cubeWidth }, { cx+cubeWidth, cy-cubeWidth, cz - cubeWidth }, { cx+cubeWidth, cy, cz …

Member Avatar
Member Avatar
+0 forum 1

Hello! Badly need help. I need to do a program that will produce odd & even numbers using loop structure Sample output: Enter a number: 5 This number is an odd number! Input 1 to run the program again Input 2 to stop Enter your Choice: 1 Enter a number: 6 This number is and even number! Input 1 to run the program again Input 2 to stop Enter your choice: 2 THANKS FOR HELPING!

Member Avatar
Member Avatar
+0 forum 3

Can you please help me with my Problem here? What I want to do is: 1. Input Username & Password (Make Password in Asterisk (*)) 2. If it is True / Right Proceed to the Main Program 3. Else If False/Wrong give another Trial (Do you want to try again? Continue? (Y/N) 4. If ‘Y’ then go back to No.1 5. Else If ‘N’ then exit program The Error is this: A. The Password is not masked in Asterisk (*) I’ve tried to use this: for(int i=0;i<8;i++) { pass[i]=getch(); printf("*"); pass[10] = passWord; } But whenever I put a Wrong …

Member Avatar
Member Avatar
+0 forum 2

I have this simple problem but im still newb to vb.net where i should Reverse the "hello world" and the result "olleh" without the world without using any function like strReverse() its very hard for me any ideas would be helpful

Member Avatar
Member Avatar
+0 forum 1

Hi All, I have a game which I'm implementing parallax scrolling which is currently looping infinite. Is there a way I can pause the loop for x amount of time, or even stop the loop completely after x amount of time. Here a bit of my code so far: public Vector2 speed = new Vector2(10, 10); public Vector2 dir = new Vector2(-1, 0); public bool isLinkedToCamera = false; public bool isLooping = false; private List<Transform> bgPart; // Use this for initialization void Start () { if (isLooping) { bgPart = new List<Transform>(); for (int i = 0; i < transform.childCount; …

Member Avatar
+0 forum 0

I have a python code that reads several csv files and writes teh data to a single file but every time it loops back around to the next file it prints the headers again. Is there a way to stop this I can post my code if it is nessisary.

Member Avatar
Member Avatar
+0 forum 4

I am new to programming and I am having a problem grasping the concept of looping an array. How do I go about doing this?

Member Avatar
Member Avatar
+0 forum 3

Hello, I'm currently working on a school project in which i can not get my head around into figuring out how to make a loop until the user has input an interger this is what i have so far : width = "hi" length = "hello" while width != int and length != int: width = int(input("Please enter the width of your garden in meters ")) length = int(input("Please enter the length of your garden in meters ")) obviously more needs to be added but the program still blows up every time a non integer value has been entered any …

Member Avatar
Member Avatar
+0 forum 5

Here is exercise in error handling, while looping and for looping with itertools.chain. It is also exercise of functions not letting user to go without giving proper input. I call them to myself 'jail functions'. Here you could add as an exercise breaking out of loop and continuing until user request to quit. The code works in both Python2 and Python3 with Python2 input overwritten to be raw_input.

Member Avatar
Member Avatar
+0 forum 1

whats wrong with this code? It keeps giving me an "unreachable code detected " exception public static int search(string Registration) { // this method will search for registration, if found it will return the index value , else it will return max value + 1 for (int x = 0; x < numOfRowsCars; x++) { reg = ds1.Tables["tblCars"].Rows[x][2].ToString(); MessageBox.Show(reg); if (Registration == reg) { // Then return the index of the registration number return x; } else { // Then return the max index + 1 return numOfRowsCars; } } }

Member Avatar
Member Avatar
+0 forum 3

can help me?

Member Avatar
Member Avatar
-1 forum 2

In this code, I need to put a limitation in every part where the user is asked to input data. The user will be asked to input a grade ranging from 50-100, and if his input is not in the range, the program will display a warning, and if the user inputted the wrong range 3 times, the program will terminate. What should be the proper way? I can't get it right when I use iteratives. code: #include<stdio.h> #include<conio.h> main () { float csPrelim, prelimExam, prelimGrade; float csMidterm, midtermExam, midtermGrade; float csFinals, finalsExam, finalsGrade; int username,userpass; int a; a = …

Member Avatar
Member Avatar
+0 forum 1

Today I have finally made up my mind to quit bat scripting and go for powershell... I need to do a quick script bascially trying to looping through a command output.. can anyone shed some light? i tried foreach ($col in 'app-command -argument') { echo $col } well, guess my guess isn't correct. Can anyone help me with this? Thanks thanks

Member Avatar
+0 forum 0

d

Member Avatar
Member Avatar
+0 forum 4

I get an infinite loop when i input 1 and 5 in this program. Please help me detect the error. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Graphs { class Program { static void Main(string[] args) { string[] cities = new string[10] { "Makati City", "Taguig City", "Imus City", "Dasmariñas City", "Tagaytay City", "Parañaque City", "Muntinlupa City", "Sta. Rosa City", "Calamba City", "Tanauan City" }; int[,] mapGraph = new int[10, 10] { {0,1,0,0,0,0,0,0,0,0 }, {1,0,1,0,0,1,0,0,0,0 }, {0,1,0,1,0,0,0,0,0,0 }, {0,0,1,0,0,0,0,0,0,0 }, {0,0,0,1,0,0,0,1,0,0 }, {0,1,0,0,0,0,1,0,0,0 }, {0,0,0,0,0,1,0,1,0,0 }, {0,0,0,0,1,0,1,0,1,0 }, {0,0,0,0,0,0,0,1,0,1 }, {0,0,0,0,0,0,0,0,1,0 } }; int source = 0, destinaton …

Member Avatar
+0 forum 0

Hello, Would you please help me? my code is not executing loop to allow user to play again after user cin>> yes. also the code suppose to allow user 10 tries to guess the number then stop, I am using this code if ((i = 10) && (userGuess != RANDOM_NUMBER)){ cout << "\nYou have reached maximum guess allowed!"; } but it's not working. #include <iostream> #include <cstdlib> #include <ctime> #include <limits> #include "Assignment3.h" using namespace std; GuessingGame::GuessingGame() { //start random number clock at 0 srand(static_cast<unsigned int>(time(NULL))); randomNumber = rand() % MAX_NUMBER + 1; // formula for computer to create number …

Member Avatar
Member Avatar
+0 forum 15

Hi there, I was wondering what the string.split() does. And another question is that I want to loop through the class like Math and find out what functions are defined in it.But, I was not too sure how to that. I tried a couple of things but they unfortunately didn't work. Thank you..

Member Avatar
Member Avatar
+0 forum 2

Hello, Im trying to design a module in which, using an equation, x and y coordinates are found and i want to display them in a list box. The general idea in my mind is that the program asks the user to enter the length and number of divisions (lets suppose length is 1 and divisons are 1000) so 1 divided by 1000 equals 0.001, that is i want the value of x, starting from 0 then 0.001 then 0.002 then 0.003 and so on till 1 and its corresponding value of y and adding it simultaneously to the list …

Member Avatar
Member Avatar
+0 forum 4

Hi, I am hoping you guys could help me with this. I am trying to loop number into something like this. 0 12 345 6789 here is my code: Dim i As Integer Dim j As Integer j = CInt(TextBox1.Text) For i = 0 To j label1.text = i Next I don't have any idea how will I do it like that I tried searching for other and did not understand how to do it since they normally do it on console

Member Avatar
Member Avatar
+0 forum 7

Hi all I apologies again in advance for the seemingly stupid question. I have tried googling this once but can't see to get the answer i'm looking for. Basically i have a form which can query the database depending upon what the user has selected. The trouble is if multiple results come up when it comes to building the table for the output, it seems to link it all together in one big table without putting a break in between results. I suspect that the problem lies with the WHILE statement not being setup correctly for this particular type of …

Member Avatar
Member Avatar
+0 forum 2

I want to loop through directory and process the files in them. I do this with the following code. for (root, subdirectories, files) in os.walk(dirDialoog.GetPath()): for file in files: My problem is that the files processed 2 times. I tried the next code, but in that way the files weren't selected because the subdirectory is empty. for (root, subdirectories, files) in os.walk(dirDialoog.GetPath()): for subdirectoryNaam in subdirectories: Anyone a suggestion how to solve my problem?

Member Avatar
Member Avatar
+0 forum 1

im trying to make a simple calculator: [CODE] loop = 1 while loop == 1: print "Welcome to Jakes' Calculator" print "1) addition" print "3) multiplication" choice = raw_input("Enter a number 1-4: ") break if choice.strip() == "1": a = input("enter the first number: ") b = input("enter the second number: ") c = a + b print a, "plus", b, "equals", c elif choice.strip() == "3": a = input("enter the first number: ") b = input("enter the second number: ") c = a * b print a, "times", b, "equals", c elif choice.strip() != "1" "3" : print "Not …

Member Avatar
Member Avatar
+0 forum 2

I am having trouble correcting the syntax on this problem so far and I can't seem to find my mistake any ideas on what I am doing wrong ? The object of the program is to ask user for amount of money to put in the pot, and play until the pot is empty. import random mypot = int(input("Please enter the amount of money you want in the pot: ")) diceroll1 = random.randit(1, 7) diceroll2 = random.randit(1, 7) myrole = (diceroll + diceroll2) if myrole == 7: print("Your roll was a 7 you eaerned: ", mypot + 4) else: print("Your …

Member Avatar
Member Avatar
+0 forum 4

I am writing this program about Gas mileage, In the program I am assigning a value that is -1 as a sentinel value, that's why I use the While loop. The problem is I can input [B]gallon[/B] variable, but the miles variable keep repeating over and over again. My question is how can I have the mile variable repeated only one time in the loop? So that I can solve it. [CODE]#include <stdio.h> #include <stdlib.h> int main() { int gallon; int miles; int total; total = 0; printf( "Enter gallon used (-1 to end): " ); scanf( "%d", &gallon); while( …

Member Avatar
Member Avatar
+0 forum 8

Hello everyone. I can't figure out the best way to make a simple picture loop through the screen in a predefined trajectory (e.g. elliptic). Do i need to use some math or is there a way to like draw a trajectory and bind the pic to it? Thanks in advance.

Member Avatar
Member Avatar
+0 forum 3

I have a loop that writes out data for franchises. It works the first time through, but not the 2nd. Here is the page where the data is written out: [URL="http://184.172.137.97/~royl21st/1.php"]http://184.172.137.97/~royl21st/1.php[/URL] Here is the code that spits out the wrong data after the first successful loop. Any ideas? [code] $areaCodeData = getData($sSql, $con, $dbName); $areaCodeRowCount = mySQL_num_rows($areaCodeData); $areaCodeRowCur = mysql_fetch_assoc($areaCodeData); if ($areaCodeRowCount != 0) { echo "<div class='box left'>"; // list all Area Codes for this Franchise echo "<div class='details'>"; $areaCodes = ""; for ( $ctrAreaCode = 0; $ctrAreaCode <= $areaCodeRowCount - 1; $ctrAreaCode += 1) { // grab AreaCodes …

Member Avatar
Member Avatar
+0 forum 3

I need some help with a code I'm writing. The user inputs some letters, a loop is ran to check if it's a vowel or consonant, then when the user is done it returns the total amount of vowels and consonants. The problem I'm having is the loop is suppose to stop when the user clicks Ctrl + X, but I can't get it to work. For now as a test I have it stop when the user enters 'z'. Any help would be VERY appreciated! [code]#include <iostream> using namespace std; void is_vowel(int & vowel, int & cons, char ch); …

Member Avatar
Member Avatar
+0 forum 11

I am trying to print out a chess board on the console. The data structure i am using is a set of pairs. I am having trouble accessing the pair's elements. I do realize a map is probably better in this case but i am using somebody else's code so I don't want to mess with it. Thanks in advance! error i am getting says: error: 'struct std::_Rb_tree_const_iterator<const char*>' has no member named 'second' Here is my code: [CODE] set< const pair<char, pair<int, int> >* > chosen; for (int row=0; row<8; row++){ for (int col=0; col<8; col++) { for (typename …

Member Avatar
Member Avatar
+0 forum 1

I'm having a problem with a code to display the vowels used in a string for example: "I LOVE YOU" the code will display "The vowels used are: e i o u" Any help? I'm supposed to use loops such as foreach, for, do-while, etc. and arrays..

Member Avatar
Member Avatar
+0 forum 4

I'm wondering if someone can help me figure out my getAverageLength method in the following code: [CODE]package com.abc.text; public class StringProcessing { /** * Returns the number of non-null strings in the set. * If null or a zero-length array is passed in, then zero is returned. * If a slot in the array is null, then it is ignored (not counted). */ public static int getCount(String[] set) { int stringCounter = 0; if (set == null || set.length == 0) { return 0; } else { for (int a = 0; a < set.length; a++) { if (set[a] == …

Member Avatar
Member Avatar
+0 forum 8

The End.