[Solved] What does %*c do when getting input from stdin? [closed]

[ad_1] The starting asterisk indicates that the data is to be read from the stream but ignored (i.e. it is not stored in the location pointed by an argument). Reference: http://www.cplusplus.com/reference/cstdio/scanf/ So the data would not be saved in the variable. 1 [ad_2] solved What does %*c do when getting input from stdin? [closed]

[Solved] Issue with substr C++

[ad_1] As mentioned you can’t call substr() with a std::ifstream. What you probably meant was to take the parts from the line string read in a[i]= stoi(line.substr(4,2)); name[i]= line.substr(18,15); b[i]= stoi(line.substr(36,1)); Also note you’ll need to convert the substrings extracted to a number (instead of assigning them directly), hence I have added the stoi(). As … Read more

[Solved] Python take a variable number of inputs? [closed]

[ad_1] amount = int(input(“Enter the amount of numbers that you have: “)) numbers = [] for i in range(amount): new = input(‘Enter number {}: ‘.format(i+1)) numbers.append(new) print(numbers) You should probably do some reading on loops in Python. 2 [ad_2] solved Python take a variable number of inputs? [closed]

[Solved] Analyzing strings in Python [closed]

[ad_1] You can count the length of the string using function len. str can contain all chars and letters. Try the following code: word = input(“Waiting for input: “) print(“Found “+str(len(word))+” letters!”) Testing it: Waiting for input: hello Found 5 letters! Testing it with numbers and other chars: Waiting for input: hello123!@# Found 11 letters! … Read more

[Solved] Determine whether the input matches a specified format

[ad_1] Using a regex would work like this: import re regex = r’\d-\d{4}-\d{4}-\d’ preg = re.compile(regex) s1 = ‘9-9715-0210-0’ s2 = ‘997-150-210-0’ m1 = preg.match(s1) m2 = preg.match(s2) if m1: print(‘String s1 is valid’) else: print(‘String s1 is invalid’) if m2: print(‘String s2 is valid’) else: print(‘String s2 is invalid’) You can try the code … Read more

[Solved] Taking input of a graph from text file in java till the end of file [closed]

[ad_1] a fast google search popped up this example https://www.mkyong.com/java8/java-8-stream-read-a-file-line-by-line/. for each line you get a String. split the string on whitespace: String[] lineArr = line.split(” “); Then use the 3 values in the array to create your stuff. easy peasy 🙂 0 [ad_2] solved Taking input of a graph from text file in java … Read more

[Solved] Specifying a path for a user defined file name [closed]

[ad_1] By default, the file gets created where ever the project files are for visual studio. because of $(ProjectDir) specified in Working Directory setting. consider: right-click on your project -> Properties -> configuration properties -> Debugging -> Working Directory always make sure you are changing/viewing the active configuration and active platform setting in that window … Read more

[Solved] How can I get the new value of an input with jquery

[ad_1] Not sure if this is what you mean. But I’ve created a sample here where every click event it will get the value of the input fields. <input type=”text” id=”name”/> <input type=”text” id=”number”/> <button id=”getvalue”>Get value</button> Here’s the js $(document).ready( function(){ $(‘#getvalue’).click( function() { var nameVal = $(‘#name’).val(); var numVal = $(‘#number’).val(); if(nameVal == … Read more