iam trying to extract a individual character. for example, during run time the user enters 110111 as input. can any 1 help me with the code to extract these input and store them in an array as individual elements.
Fairly new at C++ but I believe something like this will work. Comments or improvements appreciated.
cout << "Please enter some text below:\n";
//string to hold user input
//user inputs info
cin >> userInput;
//create a char array of desired length.
//loop through the string
for(int index = 0; index < (int)userInput.length(); index++)
//if the userinput equals something
if(userInput[index] == '1')
chrArray[index] = userInput[index];
//just pausing so console will stay up
Edited 7 Years Ago by RunTimeError: Re-edited code
I am writing a java program that needs to execute shell commands, so I wrote a function that would take the command to execute as a string (ie: "mkdir ~/Folder1") and execute that command with the shell. Here is the function:
Runtime run = Runtime.getRuntime();
Process pr = ...
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.