I'm trying to find vertical paths of length n through a 2D grid of numbers. Paths may connect orthogonally or diagonally. An example grid and an example possible path looks like this:
A example possible path of length n = 3 is running from (3,2) to (3,4) - All 1s ...An example of n = 4 is the run of 3s (1,1) (0,2) (0,3), (0,4)
What is an efficient algorithm for solving this kind of problem? I would like to solve (ideally) millions of grids, giving a list for each grid of all possible paths of length for n = 3-6.
I need to be able to find every possible permutation using all possible values of a char. But I have to make it be able to form permutations from a length of 1 to variable N. For example, if N=3, I need it to be able to come up with
How could I do this. (I would like to avoid recursion, since N might be as large as 50 or 60 and using recursion would most likely cause a stack overflow)
printf(" Enter a line of Morse Code for decrypting"); scanf("%s",phr); len=strlen(phr); for(a=0;a<36;a++) { if(strcmp(phr, morse[a])==0) printf("%c", alpha[a]); };printf(" ");
The output :
[output] Enter line to encrypt: ..... -.... --...
converting... 5 [/output]
It should read all code, including null. between coded letter one space, between coded word three spaces.
I am working on a c-programm. In this program I have to convert the amount of money I read on two variables into the corret format. I got Euros and cents on 2 ints. But now I want to add both of those variables in a String (char array). Also i want to find out the length of the new char array.
Ok my assignment has me doing vector math with some canned code provided for me by the instructor This is the header file to the class I'm working with and the .cpp file as far as I've gotten it.
#pragma once #include "Scalar.h" class Vector2D { public:
Vector2D(); Vector2D( const Vector2D& ) ;// copy constructor Vector2D( Scalar element[2] ) ; // initialize with an array
[Code] ....
I'm having trouble seeing which data members I'm multiplying together and what the initial state, continuing state, and after loop action I'm supposed to be using in the for loop.
I have a question about finding the length of first sentence in an input string.
For example, let the input string be: dream in code. community learning
The length of first sentence is 13 (blanks are included). My question is how to create conditions for multiple punctuation signs (!,?)? If while loop goes like:
I have a adjacency matrix. (router adjacency matrix in network). The result should be the router ID.I mean, print all the possible paths from source router to target router(ROUTER id>> 1 - 2 - 3 - 4 so there are four one router). I get the error in the output.)
Code: #include<stdio.h> #include<conio.h> /* graph: Pointer to the starting of mXn matrix i, j: Current position of the robot (For the first call use 0,0) m, n: Dimentions of given the matrix pi: Next index to be filed in path array
is there any way to have the program control go some two paths at once? For example: if my program has two functions, one that does some simple calculation that requires nothing from outside it to set the variables and another that displays text for the user to read then enter something. Is there any way to have both run at the same time?
simpleFnc() {int a = 1; int b = 2 ; int c = a+b ;
[code]....
There is no connection of simplefnc to anywhere else in the program so is there any way to get it to run at the same time the other function is running?
I get a error "Not all code paths return a value" what is the reason i get this error
public String giveHint() { int hintPossible, x, y, val; _game.hint(out hintPossible, out x, out y, out val); if (hintPossible == 1) return "x: " + x + "y: " + y + "val: " + val; }
giveHint() has a red underline and it says not all code path returns a value ....
I have written the below but I get an error when I run it. I get the below error.
$mcs main.cs -out:demo.exe 2>&1
main.cs(93,58): warning CS0162: Unreachable code detected main.cs(85,21): error CS0161: `CreditCards.CreditCardsValidator.LuhnCheckPerformed(string)': not all code paths return a value Compilation failed: 1 error(s), 1 warnings
The code is below: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; /**@return a Credit Card Validation Application
I am trying to read data from more than one file at once. The files are different types e.g. one is a text file one is an xml file like so, StudentInformation.txt, CollegeInformation.xml. The files are all stored in one place, in this case on the D drive of a local computer. I am trying to locate any files in the D drive with a file extension of .txt or of .xml (there may be more than two of these files in the future, so I'm trying to allow for that). Then I want to open all of these files, extract the information and output all the information in one display window. I want all the information from these two or more files to be displayed together in the display window.
Here is the code so far. It is throwing up errors.
I am trying to include library paths in VS 2012 through the new property pages.I downloaded and installed mpich2-64 bit libraries under "C:Program FilesMPICH2include" and set the include path in Microsoft.cpp.x64.user property file so the path now looks like
Scaling the yaxis on my histogram for one of my class projects. I've gotten mostly everything but stuck on scaling. I'm pretty sure it's something simple to do, but I'm having trouble, and I've tried everything to my knowledge to get it scaled from 0.1 - 1, like this:
Here is my code:
#include<stdio.h> //include all preprocessor directives #include<Windows.h> int main(void) { int MAX = 0; //initialize and declare variables int allcounts [10] = {0}; //store an array of integers for int yaxis, xaxis = 0;
[Code] ....
I'm close, but every time I try and change my y axis in the for loop from 1 going down to 0.1, it doesn't give me a right output.
I have an MDI MFC application which has a menu at the top. Nothing particularly unusual about that, but for some reason my application seems to have a vertical spacing about 30%-40% bigger than "normal" on the drop down menus (when compared with Visual Studio itself).
I've looked thru the options for CMenu, CMFCMenuBar, CMFCVisualManager, but can't seem to find anything to explain why my menu has such a large vertical spacing between options, nor how to change it.
I am attempting to create a program which calculates the product of 4 vertical values in the matrix. The numbers are supposed to be randomly generated and the size of the matrix is given through the command window.
However I seem to have either not pointed my matrix through all of my functions correctly, or my logic is off somewhere as I keep getting this output regardless of the size of matrix I put in:
"the location of the highest horizontal line product is: 5 0 and is the number: 0
The overall max value is 4196352 at the above coordinates."
using namespace::std; //srand(time(0)); int h_line(int**, int, int); int v_line(int, int,int); int diagnol_left(int,int,int);
im trying to code a simple list box for my self made GUI but i seem to be stuck at the scroll bar. I already finished with the calculation for the scroll bar size but how I could calculate it's current vertical position depending on the current item on top of the list box.
My current code looks like this
ListBox struct: struct MenuListBox { int PosX; int PosY; int Width; int ItemsVisible; //Items visible at the same time int CurrentItem;
How to fix this when i run the program and enter my name then output my name in vertical position using the for loop and press enter the program do not stop
In a MDI-app with some toolbars and statusbar I created also a controlbar which can be docked to the left side. My problem now: how do I get the exact height of the controlbar?
In CalcDynamicLayout I set the height for the docked state to the height of the mainframe. This value is too big, but it will work basically.
But how can I get the exact height of the controlbar?
I want to create a vertical histogram in my code. I already made it go vertical but not the way I want it.
Example: I want it like this:
Range1 Range2 Range3 Range4
And asterisks under each one, depending on the user input. (My code is below and doing it on here doesn't make it come out correctly)
But what I've managed to do is this:
Range1 * * *
Range2 * *
Range3 * * * *
Range4 * *
Which I don't want. I want everything else to stay pretty much the same since I can only use some features such as Arrays and really basic functions.
Here is my code: (Worked fine last time I used it and I am doing it on Visual Studio 2010 (at uni) and 2013 (on my laptop)).
#include <iostream> //Start of code using namespace std; int MarkValueInput; //Mark entered by user //Counter variables for ranges in While Loop int counterlow; //Counter for low range int countermidlow; //Counter for mid-low range int countermidhigh; //Counter for mid-high range int counterhigh; //Counter for high range
This program needs to display a vertical graph of asterisks showing production for each plant in the company ...
Here is what I have so far:
*********************************** This program will read data and display a vertical graph showing productivity for each plant. Reference Display 7.8 pg. 401-3 *********************************** */ #include <iostream>
I'm having a custom control and I added a vertical scroll bar to it. After scrolling down and then up what all controls are added are disappeared. Controls added are (checkboxes, editboxes, browse button).
Scroll works fine. Looks like painting problem but unable to resolve the issue.