[Solved] User Input + Random Word and Number printing

[ad_1] input and occupation are defined outside the scope of the occupationsfunction. Either declare it as a global variable with $input and $occupation, declare it inside the function or pass the variables as arguments to the function (as Lee suggested): puts ‘What is your name?(Enter in field below)’ $input = gets.chomp puts ‘end’ occupationslist = … Read more

[Solved] this c program is not giving correct output.(to convert number string to integer) [duplicate]

[ad_1] The problem is near break statement, Your break statement is being executed without executing a++;. Here is the correct code. #include<stdio.h> #include<string.h> void main() { int a=0, copy[10]={0},len,i; char string[10]; clrscr(); puts(“enter a number string”); gets(string); len=strlen(string); while(a<len) { for(i=48;i<=57;i++) { if(string[a]==i) { copy[a]=i-48; a++; break; } } } for(i=0;i<len;i++) printf(“%d”,copy[i]); getch(); } [ad_2] … Read more

[Solved] How to add a value in a matrix and make it decrease in radial way? [closed]

[ad_1] [EDIT] So based on you’re edit i thought this solution. Since you don’t specify any programming language i’ll use some c-like functional programming. I’ll leave you the work of transforming it to object oriented if you need it. Input: Global maxtrix that starts in M[0,0] and ends in M[100’000, 100’000] (Note that, to make … Read more

[Solved] Okay so I’m coding a roll the dice game on java

[ad_1] In your for loop: Remove the semicolon (;) just after the for(int rolls= 1; rolls==trials; rolls++) line. Change: for(int rolls= 1; rolls==trials; rolls++) to: for(int rolls= 1; rolls<=trials; rolls++) As far as changing switch to if–else–if, not sure why you would want to do this, but simply write it as: if(face == 1){ one++; … Read more

[Solved] Convert.ToInt32(“example”) Collisions? [closed]

[ad_1] No, Convert.ToInt32(text) will just try to parse your text to an int, like: Convert.ToInt32(“032”) will return 32 as int but Convert.ToInt32(“Brian”) will throw an exception. I assume that you want to have some kind of hashing, when you say “different words to the same int”. Try GetHashCode(). It will return the same value if … Read more

[Solved] How Retrofit library working faster than default AsyncTask? [closed]

[ad_1] Async task execute serially and are single threaded by default and they will wait for last call to complete before execution of next one and designed in a way so that to avoid common errors due to parallel running threads. Retrofit is not. It sends calls parallely and use ThreadPoolExecutor. 1 [ad_2] solved How … Read more

[Solved] I need to implement a flutter app, when 2 phones come near it must alert the 2 phones [closed]

[ad_1] You can use the location of the device and store the lat and long of the device in the backend(probably AWS if you are using it!). Every device registers to your app will be sending its realtime lat and long to your backend. You can have some sort of computation or graph-based analysis in … Read more

[Solved] Changing img src in jQuery

[ad_1] check to HTML <ul class=”social-media-nav-center”> <li> <a href=”https://twitter.com/” target=”_blank”><img id=”twitter” class=”small” src=”https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRgdlWvqZIB0r6qkjFS_t9uMKD9gQIVMV3fE-Vw9BMoRfNEmJG2″ /> </a> </li> </ul> Jquqey $(document).ready(function(){ $(window).scroll(function(){ if($(window).scrollTop() > $(window).height()) { $(“#twitter”).attr(“src”, “http://www.planwallpaper.com/static/images/744081-background-wallpaper.jpg”); } }) }) CSS .social-media-nav-center{height:1000px;} https://jsfiddle.net/yakcbanL/ 2 [ad_2] solved Changing img src in jQuery

[Solved] Create a pattern that looks like this in a file with n number of lines

[ad_1] Here: def make_pattern(file_path, n): with open(file_path,’w’) as f: f.write(‘\n’.join([‘*’*(i+1) if (i+1)%2 else ‘#’*(i+1) for i in range(n)])) # write each string in the list joined by a newline make_pattern(“t.txt”, 5) Output file (t.txt): * ## *** #### ***** [ad_2] solved Create a pattern that looks like this in a file with n number of … Read more