Search the Community
Showing results for tags 'loops'.
-
Hey everyone, Just yesterday I decided to clean up my pc a bit, so i did some cable management in the back of my case and I pulled out my RAM sticks because I wanted to color them black, but that's basically all i did. note(I ended up not coloring the ram sticks) When I plugged everything back into my pc I watched a few YT vids when i noticed that my computer had started to paste whatever i copied latest using CTRL+C and CTRL+V, and it wouldn't stop doing it, and kept going in every search bar i clicked, in windows explorer, chrome, start menu etc. My keyboard became completely unresponsive, mouse was fine though, but the spamming/looping didn't stop even after I pulled out the keyboard. I tried switching my ram sticks but to see no change. any idea what it could be? I think my keyboard was plugged into a usb 3.1 port when it happened, could it have anything to do with it? Specs: OS: Windows 10 Anniversary Edition x64 system. Version 10.0.1393 build 14393 Core i3 6100 3.7GHz Ram: 2x8 Corsair Vengeance LPX 3000MHz GPU: Asus Strix 1070 8gb Storage (OS): Kingston 120GB Additional storage: Kingston 120GB + 500GB Seagate PSU: Corsair CX650 MOBO: Gigabyte Z170 Gaming K3 BIOS Version: F2, March 10 2016 Turning it on and off again fixes it for a few minutes but it promptly comes back later in the midst of doing things like dragging and dropping images from chrome... KeyboardL Steelseries 6GV2 Moues: Logitech G502 Proteus Core Gamepad(If it makes a difference idk): Logitech F310
-
Hello, I trying to figure out how to get started with writing a program for my python class. I'm having trouble grasping loops and conditionals. I have completed this assignment before but without the use of loop structure. I've attached screenshots of both the new assignment and what I did previously to this post. Thanks in advance for any help.
- 6 replies
-
- python 3.6
- programming
-
(and 2 more)
Tagged with:
-
So I'm working on a build that I want to put a loop into (cpu and gpu) but I need some ideas. This build is directed towards gaming, so im sticking with the I7, so please save yourself time and dont say switch to ryzen. Also im sticking with soft tube so yeah. Just tell me what parts you use in your loop! my build: https://pcpartpicker.com/user/DouglasTheDuck/saved/CTGmGX
-
this should be something simple but i havent managed to find anything about it on the internet. maybe i searched it wrong. idk, anyway this is what i have tried. //i want to show value of i from 10 to 0. i have tried both methods below but nothing happens for (int i = 10; i == 0; i--) { MessageBox.Show(i.ToString()); } for (int i = 10; i.Equals(0); i--) { MessageBox.Show(i.ToString()); } //normal loops like this work for (int i = 0; i < 10; i++) { MessageBox.Show(i.ToString()); }
-
I am looking for a way to draw 25 stars all with a different number of spikes and different levels of spikiness based on what I have so far in my program. I've tried looping through it with no luck (probably because I doing it wrong). I suppose you could say I would want to randomly generate the values? I would really appreciate the help on this. I am using DrawingPanel.java for this My code: My output: Goal output:
-
Hi, Thanks for helping me out, if you're wondering why I'm not posting on stack overflow, it's because I have a cool down for some reason. Here's my code: Okay, as you can probably see. I'm trying to get my program to loop back to the beginning whenever K is turned into something other than 0. Any loops I try result in it either not working or a crash. I think I'm missing something really essential from a while loop, and I can't seem to think what it is. Thanks for helping me out, and sorry if I explained this poorly.
-
Greetings, I'm having trouble creating the spikiness (to turn the circle created via polygon into a star). Basically I want to add points out of the circle to turn it into a star. I don't know how to go about creating the code for the spikiness (turning the circle polygon into a star). I believe the error is with drawing the final polygon and casting but I am not quite sure. Notes: The spikiness parameter can range from 0.0 to 1.0 with 0.0 being not spikey (like a soccer ball) and 1.0 being extremely spikey (like a sea urchin). The spikiness parameter determines the radius of the inner circle using the formula: innerRadius = radius * (1.0 - spikiness) (An example formula I tried implementing but with no success) I'd appreciate the help! My code: import java.awt.*; public class StarSampler { public static void main(String[] args) { DrawingPanel panel = new DrawingPanel(500, 500); Graphics2D g = panel.getGraphics(); g.setColor(Color.YELLOW); fillStar(g, 250, 250, 100, 36, 1); } public static void fillStar(Graphics2D g, int ctrX, int ctrY, int radius, int nPoints, double spikiness) { double xDouble[] = new double[2*nPoints]; double yDouble[] = new double[2*nPoints]; for (int i = 0; i < 2*nPoints; i++) { double iRadius = (i % 2 == 0) ? radius : (radius * spikiness); double angle = i * 360.0 / (2*nPoints); xDouble[i] = ctrX + iRadius * Math.cos(Math.toRadians(angle)); yDouble[i] = ctrY + iRadius * Math.sin(Math.toRadians(angle)); for (int j = 0; j < nPoints; j++) // Casts for ints and doubles { int xPoint[]; int yPoint[]; xPoint[j] = (int) xDouble[j]; yPoint[j] = (int) yDouble[j]; } } g.fillPolygon(xPoint, yPoint, nPoints); // Creates polygon } }
-
I've been working on a capture the flag and one of the problems is called Zipfinity. The CTF works in a VM on ubuntu linux. Here is the info it gives you-- "Because I like really small files, I zipped the flag 10,000 times! Unless you want to spend hours clicking stuff, you better make a program that does it for you! Personally, I recommend python and the zipfile module. This will likely crash your VM if you aren't careful" I'm very new to programming so forgive me if I have major flaws, but here is the code I wrote. #!/bin/env python3 from zipfile import ZipFile file_name= zyp + int + .zip int = 9999 while int > 0: with ZipFile (file_name, 'r') as zip: zip.printdir() print('extracting all the files now...') zip.extractall() print('done') int -= 1 The problem is in the line that starts file_name=. Terminal tells me that there is invalid syntax and points to the .zip The original file name is zyp9999.zip and when extracted turns into zyp9998.zip so my idea was to create some sort of format where only the number changed. I wasn't sure what to search google for either to help me. I tried learning about writing over files but I didn't understand. So the file_name = zyp + int + .zip was kinda just a shot in the dark that didn't work. I attached the zip if it might help anyone. zyp9999.zip
-
Hi, I had a homework assignment due a few months ago that i got a mostly good grade on, however there was one problem with my code. It would never count the first negative number I entered, but it would count all the ones after that. I'm not sure how to fix this, and I didn't get any feedback from my instructor. Here is the code: #include<stdio.h> main() { int user_input = 0; int total_sum = 0; int positive_sum = 0; int negative_sum = 0; int nonzero_count = 0; int positive_count = 0; int negative_count = 0; int largest = 0; int smallest = 0; int largest_positive = -65535; int smallest_positive = 65535; int largest_negative = -65535; int smallest_negative = 65535; float average = 0; float average_positive = 0; float average_negative = 0; printf("Enter an integer:\n"); scanf("%d", &user_input); while(user_input != 0) { nonzero_count++; total_sum = total_sum + user_input; average = (float)total_sum/(float)nonzero_count; if(user_input > largest) largest = user_input; if(user_input < smallest) smallest = user_input; printf("Enter an integer:\n"); scanf("%d", &user_input); if(user_input > 0) { positive_count++; positive_sum = positive_sum + user_input; average_positive = (float)positive_sum/(float)positive_count; if(user_input > largest_positive) { largest_positive = user_input; } if(user_input < smallest_positive) { smallest_positive = user_input; } } else if(user_input < 0) { negative_count++; negative_sum = negative_sum + user_input; average_negative = (float)negative_sum/(float)negative_count; if(user_input > largest_negative) { largest_negative = user_input; } if(user_input < smallest_negative) { smallest_negative = user_input; } } } printf("Overall:\n"); printf("Count is %d, sum is %d, maximum is %d, minimum is %d, average is %f\n\n", nonzero_count, total_sum, largest, smallest, average); printf("Positives:\n"); printf("Count is %d, sum is %d, maximum is %d, minimum is %d, average is %f\n\n", positive_count, positive_sum, largest_positive, smallest_positive, average_positive); printf("Negatives:\n"); printf("Count is %d, sum is %d, maximum is %d, minimum is %d, average is %f\n\n", negative_count, negative_sum, largest_negative, smallest_negative, average_negative); } My problem happens when trying to do the math on counting the number of negative numbers. It will always ignore the first negative number but count the rest, except in the overall counter. Here is an example of what I'm talking about: And with an extra negative number: Here it is with the full set of numbers I was instructed to use: I'm not sure if it's a problem with the placement or types of my if statements, but it's the only thing I can think of that would affect whether a number would get evaluated in the loop. Any advice would be greatly appreciated! Thanks! EDIT: To be more exact about the problem, the sum, maximum and minimum, and average seem to be working as intended in the negative loop, the only thing that is working incorrectly is the counting in the negative loop. It will count all of the negative numbers except the first one entered.
- 18 replies
-
- c
- if statements
-
(and 1 more)
Tagged with:
-
I have been trying to learn python through a book called "Introduction to Computer Science Using Python and Pygame" (it's pretty easy to find the pdf). Anyways, I came across a few questions in the book (on page 53-54) which were called advanced loop questions. It doesn't provide a walkthrough or answers at the end, so I just attempted them myself and was able to get one. I thought I would post the other questions on here if anybody can explain to me how I can complete them. Thanks! I was able to figure out the first 2 fairly easy with some help from forums and google, here is my code for them. I am just unsure on how to continue from there: Problem 1: for n in range(10): for i in range(10): print(i, end=" ") print() Problem 2: for n in range(11): for i in range(n): print(i, end=" ") print() Any help would be greatly appreciated!
-
Hello everyone. I dont think this might be a good place to ask such in depth questions about audio, but I though I would give it a go if there are any audio engineers in here. I`ve been interested in audio for the past few years, got myself a microphone, a mixer, 2 audio interfaces, etc, but have always been troubled by different kinds of noise. Up until recently I`ve used a Yamaha MG06X mixer connected to a Beringher UCA222, in which I connect a Rode NT2-A Microphone. While recording, even when my interface was at 0 gain, it has always emited a sound in the background, and I started wondering if the problem could be a possible audio loop, but never got trough searching it since my Behringher interface started having an issue and it`s through repair right now; and same goes for my other audio interface, a Scarlett 2i2, that also was faulty. Right now, I am using an old Tritton 720+ solution that was never used: https://www.manualslib.com/manual/1062758/Tritton-720Plus.html#manual Since I plugged it into one of my usb ports, I noticed that the audio recording was also having interference, but this time much louder and clearer (will be listed as mic interference in the soundcloud link below), and also noticed that pretty much everything related to audio seems kind of... broken. My speakers give out way too much interference and sometimes even radio frequencies (also listed in the soundcloud link below), my front audio jack seems to be suffering from usb audio loops and also the same frequencies that affect my speakers. What can I do or try to fix this? I thought of buying a ground loop isolator, or even an usb isolator, but that doesn't`t adress the issue of my speakers being connected to the back audio jacks and still giving out too much noise, and even if I bought a sound card, I`m scared that it could be a motherboard issue, or a eletric noise issue that will still remain. I really need help guys. Thanks. https://soundcloud.com/gabriel-mueller-529073737/sets/audio-issues
- 5 replies
-
- audio
- interference
-
(and 1 more)
Tagged with:
-
There are common ways to construct loops that make sense and are efficient, but from time to time we consider an odd loop configuration to make your loop look better or just because it is simply the only way it will work. I had a couple odd configuration questions to ask. If anyone has tried either of these or has scientific reasons as to why it is too inefficient to make sense. 1) Can you fit a 120mm radiator and a 240mm radiator (with the inlets/outlets of each radiator opposing) into a space designed for a 360mm radiator? 2) Can you have the inlet and outlet of a reservoir at the bottom? I'm considering my first loop (be nice) and am prone to thinking broadly about what can and can't be done but have no hands on experience to call upon. Anyone else have creative loop ideas that break conventionality? Anything that makes your friends say "why?" and you say "why not?"? (Dat awkward but grammatically correct punctuation tho)
-
I've just been reading about loops in C programing, and I'm trying to work out the output of some example programs, however I really can't figure out this one (Image below) I understand up to the first Two output. But after that I can't see how Two is ouputted again. It's been confusing me for days. Could anyone explain this one, then maybe I can understand the rest of the examples simular to this. Any help would be appreciated.
- 3 replies
-
- c programming
- nested loops
- (and 6 more)
-
Hi, I am new to watercooling and my last build was in 2004 so I am behind the times. My question is about the length of the loop between units. For instance do I want to have the shortest lengths in between or can I make a design out of the loops? I haven't read anywhere that there was any significant difference, but seeing what the fine folks here have to say?
- 8 replies
-
- water cooling
- loops
-
(and 2 more)
Tagged with:
-
*NOTE: i'm just starting out, so if i made some really stupid mistakes, don't bash me with them. I am creating a program where you have to insert the right password else it gives you one less try and you can try again. If you fail 3 times it locks. I already made something similar but i had the problem where it also didn't recognize the correct password. After i deleted it and quit, tried again and now i wrote this from scratch and a lot more things don't work as they should. PROBLEMS 1. How to make the while loop take the input(password in this case) and compare it to the correctPass. I just wrote 1 != 2 so it loops until it executes "else" and then breaks out of the loop, but it doesn't work. 2. Also the "attempt" subtraction part also doesn't work. 3. If i enter the correct password it still gives me the "Try again" Heres the code importjava.util.Scanner; public class Application {public static void main(String[] args) { while(1 != 2) { String correctPass = "Java"; System.out.println("Enter the password"); Scanner input = new Scanner(System.in);String line = input.nextLine(); if(line == correctPass) {System.out.println("Wellcome back sir!");break;}else {intnum = 3;System.out.println("Wrong password, please try again! " + num + " attempts left!");num = num - 1;if(num == 0) {System.out.println("System Locked!");break;}} }}}
-
Where does all of the music in the videos come from? I'm not talking about the intro but like the rock loops in Scrapyard wars and stuff like that. Also if you like technology and gaming (which I presume you do if you're on this forum) come and check out Double Click Productions Here Thanks in advance.
-
So Besides ascetics what are the pros of fully custom water cooling. Is it worth it? Also how much more of a benefit would I get from getting a maximus vii formula that a maximus vii hero or ROG posedion or ARES instead of Matrix both "optimized for water cooling" Is it more worth compared to AIO same Gfor PU as I think AIO gpu coolers are ugly. Any options similar to the EVGA hybrid? Thank you.
- 7 replies
-
- watercooling
- custom
-
(and 2 more)
Tagged with:
-
For a project, i have to create a program that can order food and add up all the totals. I am stuck on how to create a loop when the user needs to order the food. This is what i got so far: package project.pkg1; import java.util.Scanner; public class Project1 { public static void main(String[] args) { int choice = 0; String order; Scanner Keyboard = new Scanner(System.in); double num; double GoodBurger = 7.75; double GoodSalad = 7.00; double Soda = 2.00; double KidsMeal = 3.00; double tax; double subtotal = 0, total; final double salestax = 0.875; System.out.println("Welcome to Good Burger!"); System.out.println("======================="); System.out.println("Place your orders and type 'Finish' when you are done"); System.out.println("--------------------------------------------------------"); System.out.println("1. GoodBurger $7.75"); System.out.println("2. GoodSalad $ 7.00"); System.out.println("3. Soda $2.00"); System.out.println("4. KidsMeal $3.00 \n"); choice = Keyboard.nextInt(); } What do i need to do?
-
Hi guys So this is kinda a homework question. I'll have to explain all the different loops and "decision makers" in Java. Is there such a thing as a do...loop? (it's written uppon the things I'll need to explain) I know about "do...while" and "while". I could only imagine it being like a do..while loop but without the arguments (which would make it useless(?)). Thanks for any answers Greetings Marius
-
so as many here i'm trying to learn a language and my choice was ruby but i suck when it comes to loops i just can't remember any tips here about how i can practice in getting better when it comes to loops