C# :: Make User Choose A Specific Path?

May 24, 2014

I am working on a program in C# that should make a user choose a specific path for the program to work.

The path they are choosing is a path for a game and from that selected path I use coding to load pictures from to the program.

Anyhow

I am able to make the user choose a path and save the selected path in a xml file.

But the user can select ANY path.

How could I do to make the user choose a specific path that I want them to choose?

View 13 Replies


ADVERTISEMENT

C++ :: How To Make Specific Character Show Up Specific Amount Of Times

Mar 5, 2013

How do I make a specific character show up a specific amount of times?

Like I am generating a random number then I need to make "|" show up that many times on the screen.

View 1 Replies View Related

C++ :: How To Find Path To A Specific Program

Feb 16, 2014

In my C++ program, lets call it menu.exe, I want the user to be able to run a specific program when selecting a specific menu, let's call this program cios.exe.

As the users of my program can have the cios.exe installed in any folder location, I need a way to first locate where the cios.exe is located and then start it with ShellExecute. My problem is : How do I find the path to where cios.exe is located in anyones PC as it can be installed it any folder location.

View 3 Replies View Related

Visual C++ :: Get Path To Recycle Bin Folder For Specific Drive?

May 29, 2014

there's a way to get a path to the recycle bin folder for a specific drive for the current user?

Say, on the input one provides "C:" and on the output you get "C:$Recycle.BinS-1-5-18"

View 10 Replies View Related

C :: Program That Displays Menu Of Commands For User To Choose From

Aug 1, 2013

I've read that we can write a program that displays a menu of commands for the user to choose from.We can write some functions that implement these commands, then store pointers to the functions in the array :

Code:
void ( *file_cmd[])(void) = { new_cmd , open_cmd }; // 2 cmd's for simplicity

We can get a similar effect with a switch statement but using an array of function pointers gives us more flexibility since the elements of the array can be changed as the programm is running.

I decided to write an example about this in order to understand better the context, I am facing some problems though :

Code:
#include<stdio.h>
#include<stdlib.h>
typedef void (*p_foo) (int);
void foo(int x);
void foo2(int y);

[Code] .....

The problems are :

Code:
TEST2.c:9: warning: initialization from incompatible pointer type
TEST2.c:9: warning: initialization from incompatible pointer type
TEST2.c:25: error: too few arguments to function "*(arr + (long unsigned int)((long unsigned int)i * 8ul))"

View 14 Replies View Related

C :: Dynamic Memory Allocation - User To Choose Size Of Array

Dec 2, 2013

Dynamic memory allocation in array in c programming. I am trying to make the user to choose the size of array they want to engage in the game.

However, i have remove the global variable which contribute the error to my code previously. Now I assigned all the arr individually but not using the global variable. However, i still not get the desired board i want. i still keep getting 9x9 array board.

And i also need limit the board size only from 4 to 9. And how do i do that.

Code:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <conio.h>
#include <malloc.h>
#include <ctype.h>
#include <stdbool.h>

[Code] .....

View 3 Replies View Related

C++ :: Creating A Loop To Allow User To Choose To Return To Beginning Of Program Or Quit

Apr 6, 2014

I am currently having problems creating a loop that will allow my user to choose to return to the beginning of the program or quit.

#include <iostream>
using namespace std;
int main() {
int j;
do {float a;
cout << "+----Welcome to Basic Operations----+
| Select Your Operation |

[Code] .....

I have not yet finished designing the interface for a couple of the operations, but right now i am hung up on trying to return to the beginning. I believe it is because the j was defined inside do and isn't carried out of the do statement for while.

View 13 Replies View Related

C++ :: Execute Command In Command Prompt From Specific Path

Feb 15, 2013

I am facing a problem in C++,I want to execute a command in Command prompt from a specific path.I am able o select a path and execute cmd.exe using the function ShellExecute but the problem is after selecting the path I am not able to execute the command, the command is appearing on another command prompt.

View 4 Replies View Related

C/C++ :: Prompting User For The Path Of A File

Feb 14, 2014

Suppose there are two cpp programs and we want the user to put the complete path of the first cpp file into second cpp file while it(second file) is running and compile and show the output there, so how can this be done?

View 3 Replies View Related

C/C++ :: Taking In File Path Names From User

Jul 22, 2014

How can I take in a path name like "C:myfolderfile.txt" where the user enters exactly that? I've tried putting the arg into a string, then looping through the string to find the '\', but by that time it is too late as c++ considers the '' as a escape character.

Is this even possible? I've googled it and everyone just says to make the user input the path with double \ or with a /.

View 1 Replies View Related

C++ :: Determine Number Of Times Change Each Specific Character In String To Make It Palindrome

Feb 19, 2015

I'm trying to determine the number of times I have to change each specific character in a string to make it a palindrome. You can only change a character one at a time from the end.

Example: "abc" -> "abb" -> "aba" should print 2. "aba" will print 0 because it's already a palindrome. "abcd" -> "abcc" -> "abcb" -> "abca" -> "abba" will print 4 because it took 4 changes to make a palindrome.

I'm not too sure how to approach this - I figured out the case where if it's a palindrome (if reversed string is the same) then it'll print out a 0.

int main() {
int number;
cin >> number; //expecting a number for first line user input
for (int i = 0; i < number; i++) {
string str;

[Code] ....

View 1 Replies View Related

Visual C++ :: Puzzle Game - Implement A Way To Save Board State Throughout User Inputted Path

Mar 16, 2013

I've been trying to figure out how to implement a way to save this board state throughout a user's inputted path. At the end, I need the output to print out the board states (user's path) of how he or she got the puzzle solved. This puzzle is the 15 Puzzle; but we have it to change by the user's input on what size they want to play (3x3 to 5x5). How to save the board state of each user input, then print those out in order from beginning to solved puzzle state. Subsequently, I would also need transferring the board state to change with using a vector to store the size based on user input. How to proceed, using a first search to solve the puzzle from the current board's state.

calculations.h

Code:
/*Calculations set as a header to keep compiling simple and faster*/

#ifndef calculations
#define calculations
int solved[5][5];
void initialize(int board[][5], int);
void slide(int board[][5],int move,int);
bool isBoardSolved(int board[][5],int);

[Code] .....

View 6 Replies View Related

C++ :: Looping User Input For Specific Data Type

Apr 17, 2015

Here's my code so far:

Code:
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int dayNumber = 1;

[Code] ....

The code, when run, prompts the user to input an integer like this:

Code:

Day 1
Andy :>12
Bill :>7
Charlie :>15

Day 2
Andy :>5
Bill :>25
Charlie :>14
.
.
.
etc.

Ok, so the code prompts the user to enter an integer for each of the 3 persons and then increments the "Day" and so on... When the user enters a negative value (-1, -2, etc.), the loop is broken and the program ends. Alright, everything is hunky-dory so far. 2 things which I can't figure out.

1. when the user doesn't enter anything and just hits return, the cursor drops a line and is still awaiting an input but doesn't show the prompt "Andy :>", for example. How can I get it to repeat the last prompt when the user doesn't enter anything? Like:

Code:

Day 1
Andy :>
Andy :>
Andy :>12
Bill :>25
Charlie :>15
.
.
etc.

2. When the user enters a letter or a special character, the program blows up. How can I correct this?

I've tried changing the data type for the variable used for the input, tried using getline, get, etc. With my current beginner knowledge, I'm missing something. So how can I get this to work?

The program should allow only integers to be entered, while allowing a negative number to trigger the loop to break or the program to end, and while re-prompting the last person if the user entered an invalid input.

View 13 Replies View Related

C/C++ :: How To Ask A User To Enter Date And ISBN Number In Specific Format

Dec 4, 2014

I don't know how to ask the user to enter the date in this format (DD/MM/YY) and ISBN number with hyphens.

After user enter date and ISBN number, it should look like this:

Date: 5/24/12
ISBN: 0-000-12345-0
#include <iostream>
#include <string>
using namespace std;
int main() {
string date;//MM/DD/YY Format

[Code] ....

View 7 Replies View Related

Visual C++ :: Letting User Enter A Character On Specific Line And Place?

Aug 8, 2014

How can I create in my C++ program so a user can paste a text and then choose a character on specific line and place?. The above thing isn't that important. I just want to place a character on a specific line and place.

I mean something like this:

Enter a character:

You choosed " / "

On which line do want the character?

You choosed "Line 1 and 2"

Where do you want the the to appear on the line? (left or right)

You choose left.

Results:

Line 1. / hello

Line 2. / hello

View 8 Replies View Related

C++ :: Which Std Container To Choose

Sep 16, 2012

I have a pile of data, which i need to access frequently and fast. One entry consists of two unsigned ints, let`s call them source and destination.

One source can have several destinations, but this rarely ever happens. Several sources can have the same destination - this happens more frequently, but still scarcely.

Once the data is set up, it rarely ever changes - yet it should be possible to add or remove entries.

I now need to find all sources for a given destination, or all destinations for a given source.

The question: which stl container to choose?

I have tried a multimap, using the source as key. This works good for finding all d for a given s, but is inefficient in the other direction.

Do you think it would be more efficient to have two multimaps, sorted respectively by source and destination?

View 1 Replies View Related

C :: Make Program That Asks User For Number?

Oct 15, 2013

So I'm trying to make a program that asks the user for a number and then prints a statement the same number of times the user entered. 3 different statements, using the 3 loops (for, while, and do while). I made the program but for some reason the statement from the do while loop goes off infinitely.

MY CODE:

The error:

View 8 Replies View Related

C++ ::  How To Make A Loop Until User Asks To Break

Apr 4, 2013

I'm making a program for a MMO I play. It calculates the cash and resources needed to build certain 'modules'. I'm having trouble to do something very simple : make a loop until the user asks to break the loop. Here is what the interface looks like :

What module do you want to install?

(Examples: 'Avenger' or 'VLLT')

dd // I input this
DD. COST each : 60,000 cr.

How many do you want? (Modules left:15)
(NOTE : You may enter a negative number if you made a mistake)
3 // I input this
Current Total Module Price : 180000 cr
+6 droids

[Code] ....

The bigger code box below is a part of the code I made. What I deleted is uninteresting, it's just the same thing again : other resources, other 'modules'...

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
struct resources// Defines the amount of resources and their price

[Code] ....

View 8 Replies View Related

C++ :: How To Make Array Which Stores Values From User

Sep 22, 2013

How to make an array which stores the values i'm getting from the users?

For example if i have a function which allows the user to give me values, how can i store them in an array.

View 4 Replies View Related

C/C++ :: How To Make Input By The User Show Up Reversed

Feb 6, 2014

#include <stdio.h>
#include <string.h>
#define MAX 1000
main()
{
char text[MAX], c;
int i,s;

[Code]...

I need to edit the code here to make the input by the user show up reversed

puts("
Your reverse input is:");
for(i = length - 1; i >= 0; i--){
printf("%c",text[i]);
}

I know this is not right...

View 4 Replies View Related

C++ :: Choose A Number To Check If Prime Or Not

Oct 20, 2014

#include "stdafx.h"
#include "iostream"
using namespace std;
int main (){
int x;
int i;
int e;

[Code] ....

is the logic good ? and why the program is looping

View 3 Replies View Related

C++ :: WaveinOpen - How To Choose Audio Channel

Feb 12, 2015

I'm using waveinOpen to capture sound from my microphone. I know how to set how many channels to use, but how do you tell it what channel to use - left or right?

View 6 Replies View Related

C++ :: Choose Second Argument Passed To Nth Element

Jun 18, 2013

Here is the code,

Code:
vector<int> vec;
for(int i=0;i<10;++i)
vec.push_back(i);
random_shuffle(vec.begin(), vec.end());
nth_element(vec.begin(), vec.begin()+7, vec.end());

No matter how I choose the second argument passed to nth_element, the elements in vec are always sorted as,
0,1,2,3,4,5,6,7,8,9

What is the use of second argument here?

View 8 Replies View Related

C :: Make A File In Directory That Cannot Be Deleted By User Out Of Program

Jul 4, 2013

I have two questions about C programming here :

1. I want to make a file in the program directory that can't be deleted by user out of the program make that file.for example if I make a file named "123.xyz" by the program named "text.exe" and then exit test.exe ,if I tried to delete the file 123.xyz I faced the error and I could not do it but by the test.exe program that make that file.

2. I heard about a function called "Parbegin()".any way i want to know is there any possible way to run two or more functions of a file.c together,like the parbegin function did an do in OS?

View 2 Replies View Related

C :: How To Write A Program To Make The User Input With Text

Sep 22, 2013

I need to write a program to make the user input some text, and the first letter of each word has to be uppercase. (have to use while loops)

So for example lets say the user inputs:

i lOvE pRoGrAmMiNg

The output needs to be:

I Love Programming

Code: int main()
{
char c, lower_c;
printf("Enter Text");
while (c != '' && c >= 0)
{
if (c >= 'A' && c <= 'Z')
lower_c = c + 32;
else
lower_c = c;

[Code]...

I have started this code by making the letters lowercase (I don't know if this was the right way to approach this, ). I am not sure how proceed after this step, the step of making the first letter uppercase. (PS for the program, loops should be while loops)

View 6 Replies View Related

C# :: For Loops To Make User Defined V Shape Output

Jul 29, 2014

Write a program to ask a user to input a symbol from the keyboard and to output that symbol in a n X n/2 sized V where n = the width of the V. You must use a loop to process the data

I am stuck at trying to figure out how to do the actual output formatting. This is where I am sitting currently.

string character = "";
int vheight = 0;
Console.WriteLine("Enter the character you wish to use for your V: ");

[Code]....

so Im really just a bit stumped on how to get the actual V shape to be formatted..

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved