Search the Community
Showing results for tags 'c'.
-
Hello, Currently have B350 Tomahawk Arctic myself, which I plan on changing. How do i get the temperature on the motherboard low? Which coverage materials do I need for the motherboard and from which materials the parts should be made from to get the lowest temp? I never really explored much about this side of hardware. Used to just check if my CPU fits, now it's a whole different story. Every detail has to be accurate, just like the cooling system. I'd like to know based on what changers should I pick a new motherboard for the lowest temperature for the motherboard itself. I'll make another topic soon with my PC build and ask for possible better motherboard solutions. I myself have narrowed down a few myself but I'm sure others opinions over this forum add more value and information to this than me just checking if everything fits and reading motherboard reviews which aren't always good.
- 5 replies
-
- motherboard
- temperature
-
(and 4 more)
Tagged with:
-
web service Help with the creation of a web service in c # .NET
Weber01 posted a topic in Programming
Hi guys, today for the school they asked us to do a project as we please, it had occurred to me to create a web service with c # and .NET. I have never used these languages. You could help me kindly. THANK YOU -
Pretty simple to explain I use the same boolean value, ERROR4 in multiple places in the same function and if it ever changed from false to true I want the entire function to return false. I can obviously just check in several places to see if it is true then return true, but I will be using it in at least 15 diffrent places in the code. So is adding in at least 30 diffrent lines all doing the same check, so I'm looking for a way to do this which means I can get the entire function to return false. Summary without waffle: do this code during the code if (x ever equals y) immediately return false
-
Hello everyone, I'm currently studing computer engineer and i was looking for a good LIGHT laptop to use as my second PC. I dont need an i9-16gb ram -1tb ssd system, currently i have a Notebook with an AMD C50,3gb ram and 500gb hdd and is relative "perfect". The problem is that it's too heavy to take it to the university everyday. Curretnly i'm using C and Python, for my assignments. I know that in the future i will have to use Smaltak and Java. (I don't really know if this is important but anyway). Space is not a problem. 128GB is enough. I will install a Linu distro, like Ubuntu or Lubuntu. Extra info: I'm not going to use any 3D modelling app or AutoCad. In summary i want a light laptop (with ssd, even a small one) with enough power to take care of these tasks. All the laptos I've checked are a little bit expensive (like Surface 2 or XPS 13), probably beacuse of the I7 and 8 gb of ram. Should I go after one of these, or is there any other one that I have to consider before deciding which one to buy? Open to any recommendation, I dont know anything about laptops and wich one is good these days. (Sorry for bad english, if anything is not clear enough ask me an i will try to answer asap). Thank u.-
-
Hi, I am writing a C program that will take a certain number of characters (a word), print them backwards, and then tell the user whether or not the word is a palindrome. I ran into trouble with the scanf() function when trying to scan user input to a char variable after previously scanning into an int variable. After a quick Google search, I found out the problem was that I was not putting a space before the %c in my scanf function. But even after I put the space, the program would still loop infinitely, and I'm not sure whether it is a problem with my recursive string function or the scanf function I am using. Here is the code: #include<stdio.h> #include<stdlib.h> main() { int getString(); int maxChar; printf("Maximum number of characters for this run? "); scanf("%d", &maxChar); printf("\nEnter no more than %d characters: ", maxChar); getString(); printf("\n"); } int getString() { char c; scanf(" %c", &c); if(c != '\n') { getString(); printf("%c", c); } } As this is a homework assignment for a C class, I am not allowed to use strlen() or any other special functions. I can only use functions that I define myself (besides basic ones like printf() and scanf()). The program I have right now will take a string that the user enters and print it backwards, but only if I get rid of the scanf for the maxChar variable. Here is what the normal output looks like when it is working properly: And here it is with the new scanf function: The program will get hung here, I assume looping infinitely for some reason. If i remove the space in front of the %c in the getString() funciton, the program will crash after the max characters input like so: I assume this is not a crash but rather the program finishing after the scanf function in the getString() function reads the whitespace from the previous scanf and then cancels the if statement and prints nothing, terminating the program. I am not sure how to get around this, as we are not supposed to keep the main function relatively empty and use our own defined functions to scan user input. EDIT: I've been messing around with the program a bit just trying to get an external function which can read user input and then store it in the string array, however I have been getting a segmentation fault when I run the program. Here is the code: #include <stdio.h> main() { int getString(int maxCharacters, char characterArray[100]); int reverse(); int isPalindrome(); int maxCharacters = 0; char characterArray[100]; char programLoop = 'y'; do { printf("Maximum number of characters for this run?\n"); scanf("%d", & maxCharacters); printf("The maximum number of characters is %d\n", maxCharacters); getString(maxCharacters, characterArray); printf("Run the program again? (y/n)\n"); scanf(" %c", &programLoop); } while(programLoop == 'y'); } int getString(int maxCharacters, char characterArray[100]) { printf(" Enter no more than %d characters: ", maxCharacters); scanf(" %s", &characterArray); printf("%s\n", characterArray); } The result looks like this: I feel like its a problem in a way I am passing the characterArray array as an argument for the getString() function, but I'm not sure what I am doing wrong... Any advice would be greatly appreciated, Thanks!
-
I currently have a built pc I want to take all my parts from my current corsair 570x into a fractal Meshify C. Now I think everything should be fine but I wanted a few extra more experienced eyes on it to make sure its all going to fit. Here is my parts list with everything I have currently in the 570x https://pcpartpicker.com/user/blue2kid3/saved/#view=PPrWD3 Thank you all in advance
-
I have text and csv files which are multiple GiB in size (one CSV is 2.5GiB and another is 3.2GiB presently and growing) and I am only interested in certain lines in these text files. If I load these into an array my programme crashes as I don't have enough RAM, so how do I load only certain lines, lets say the last 50 or the last 100 lines,how do I do this in a way that doesn't require at minimum 5GiB of RAM (C requires 2 byte per character vs CSVs 1 so approx double the RAM). Which for some of the systems I am planning to run this code on won't be possible. Especially when I think the 3.2GiB File will be 50GiB soonish, so at minimum 100GiB of RAM would be needed. Long and short, what is the least resource intensive way to load only certain lines, I don't mind if the code is quite long as long as it uses minimal RAM. (it's a long story what these files are but yea.)
-
Hi, I recently had an assignment where I needed to take a range of numbers, find which ones were prime, and then give the prime factorization of the non prime numbers. I got a relatively good grade on the assignment, but I missed out on a few points for not having asterisks in between the prime factorization. I want to figure out how to fix this but I am a bit stumped. Here is the function in question: int factor(int test_num) { int potential_factor; printf("The factorization of %d is: \n", test_num); for(potential_factor = 2; potential_factor <= test_num;) { if(test_num % potential_factor == 0) { printf("%d ", potential_factor); test_num = test_num / potential_factor; } else ++potential_factor; } } This has an output like so: I want to make it so instead of "2 2" it would look like "2 * 2" And also for higher numbers, like 196 for example, the factorization should look like "2 * 2 * 7 * 7" How would I go about doing this without adding an extra asterisk at the end of the last number? Thanks! P.S. I can add the entirety of the code if you would like to look it over.
-
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 am having issues with the Visual Studio and Forms as I keep getting this error code CS0115 '_.Dispose(bool)': no suitable method found to override I think I caused it by changing the forms name, but it means my programme no longer works. Is there an easy way to fix this as I want it to be called what it is called. Thanks
-
#include <stdio.h> void main(void) { int y; double x, a, b, c, result; printf("Enter value for y: \n"); scanf_s("%lf", &y); getchar(); if (y < 60 & y > 51) { printf(" y is less than 10"); } else if (y <= 50 & y > 41) { printf(" y is greater than 10 but less than 20"); } else if (y < 40 & y>31) { printf(" y is greater than 10 but less than 20"); } else if (y < 30 & y>21) { printf(" y is greater than 10 but less than 20"); } else if (y < 20 & y>11) { printf(" y is greater than 10 but less than 20"); } else if (y < 10 & y> 0) { printf(" y is greater than 10 but less than 20"); } printf("\n Enter value for X:"); //Gets vlaue for x scanf_s("%lf", &x); //Reads in value for x getchar(); //Waits for input printf("Enter value for A:"); scanf_s("%lf", &a); getchar(); printf("Enter value for B:"); scanf_s("%lf", &b); getchar(); printf("Enter value for C:"); scanf_s("%lf", &c); getchar(); result = (a * pow(x, 2)) + (b * x) + c; return(result); } I cant seem to get any of my if statements to print no matter what value I use. I am also aware i can do it incrementaly but that is not allowed in this case. The formula for result also does not work and I am just stuck. Any help appreciated.
- 2 replies
-
- programer
- floating point
-
(and 2 more)
Tagged with:
-
#include <stdio.h> void main(void) { double y; double x, a, b, c, result; printf("Enter value for y: \n"); scanf_s("%lf", &y); getchar(); { switch (y) { case (y > 0 & y <= 10): printf("y is equal or greater than 0 and smaller than 10"); break; case (y >= 11 & y <=20 ): printf("y is equal or greater than 11 and smaller than 20"); break; case (y >= 21 & y <= 30): printf("y is equal or greater than 21 and smaller than 30"); break; case (y >= 31 & y <= 40): printf("y is equal or greater than 31 and smaller than 40"); break; case (y >= 41 & y <= 50): printf("y is equal or greater than 41 and smaller than 50"); break; case (y >= 51 & y <= 60): printf("y is equal or greater than 51 and smaller than 60"); break; default: printf("Invalid number\n"); } } printf("\n Enter value for X:"); //Gets vlaue for x scanf_s("%lf", &x); //Reads in value for x getchar(); //Waits for input printf("Enter value for A:"); scanf_s("%lf", &a); getchar(); printf("Enter value for B:"); scanf_s("%lf", &b); getchar(); printf("Enter value for C:"); scanf_s("%lf", &c); getchar(); result = (a * pow(x, 2)) + (b * x) + c; } The code keeps throwing an error in visual studio "Expression must have a constant value". Any ideas how to rectify this?
- 6 replies
-
- c
- programming
-
(and 1 more)
Tagged with:
-
Hi im having trouble getting my case function to work. I enter a number between 0-60 and it is meant to return a @your number is greater than x but less than y. It has to be done with switch statemtents but i dont know how to make this function. I am incrementing my for loop and trying to get it to work that way. Any ideas? #include <stdio.h> void main(void) { int y; double x, a, b, c, result; printf("Enter value for y: \n"); scanf_s("%lf", &y); getchar(); int counter; int min; int max; for (counter = 0; counter < 6; counter++) { // Incraments if statments up to 60 min = counter * 10; // Multiplys counter by 10 max = (counter + 1) * 10; // Allows counter up to 60 if (y >= min && y < max) // If statement for if its between 0<60 { switch (y) { case 'A': printf("y is equal or greater than %d and smaller than %d", min, max); break; case 'B': printf("y is equal or greater than %d and smaller than %d", min, max); break; case 'C': printf("y is equal or greater than %d and smaller than %d", min, max); break; case 'D': printf("y is equal or greater than %d and smaller than %d", min, max); break; case 'F': printf("y is equal or greater than %d and smaller than %d", min, max); break; default: printf("Invalid number\n"); } } } printf("\n Enter value for X:"); //Gets vlaue for x scanf_s("%lf", &x); //Reads in value for x getchar(); //Waits for input printf("Enter value for A:"); scanf_s("%lf", &a); getchar(); printf("Enter value for B:"); scanf_s("%lf", &b); getchar(); printf("Enter value for C:"); scanf_s("%lf", &c); getchar(); result = (a * pow(x, 2)) + (b * x) + c; }
- 1 reply
-
- case function
- c
-
(and 2 more)
Tagged with:
-
Hi guys just checking if i have this done correctly, or if their is something i need to change before continuing #include <stdio.h> void main(void) { struct examResults { char title[20]; unsigned int score[20]; const int myExam[17]; myExam[0] = 62; myExam[17] = 80; }; }
- 3 replies
-
- c
- programming
-
(and 2 more)
Tagged with:
-
#include <stdio.h> struct examResults { char title[20]; unsigned int score[20]; }; myExam; int main() { strcpy(myExam.title, "ClassA"); myExam.score[1] = 20; myExam.score[17] = 69; struct examresults newexamresults[15]; strcpy(newexamresults[5].title, "ClassB"); strcpy(newexamresults[7].title, "ClassC"); newexamresults[6].score[9] = 5; newexamresults[6].score[18] = 10; newexamresults[12].score[9] = 50; newexamresults[12].score[18] = 100; printf("%s\n", myExam.title); printf("%d\n", myExam.score[1]); printf("%d\n\n", myExam.score[17]); printf("%s\n", newexamresults[5].title); printf("%d\n", newexamresults[6].score[9]); printf("%d\n\n", newexamresults[6].score[18]); printf("%s\n", newexamresults[7].title); printf("%d\n", newexamresults[12].score[9]); printf("%d\n", newexamresults[12].score[18]); } I keep getting incomplete type error for "newexamresults", does anyone have any idea how to rectify this?
- 4 replies
-
- c
- programing
-
(and 2 more)
Tagged with:
-
I am programming in c and it keeps throwing exceptions. Trying to read in 4 floating point numbers then multiply them in the formula "result = ax^2+bx+c", i don't understand why my code aint working..... i keep getting the exception Error LNK2019 unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ) Formula C:\Users\james\OneDrive\Documents\Year 4\Object Programing\Formula\Formula\MSVCRTD.lib(exe_main.obj) 1 #include <stdio.h> int function() { double x, a, b, c, result; printf("Enter value for X:"); scanf_s("%lf", &x); printf("Enter value for A:"); scanf_s("%lf", &a); printf("Enter value for B:"); scanf_s("%lf", &b); printf("Enter value for C:"); scanf_s("%lf", &c); result = (a * pow(x,2)) + b * x + c; printf("result is = %lf", result); return(result); }
- 2 replies
-
- c
- floating point
-
(and 1 more)
Tagged with:
-
So i have begin coding for two years now. And I think I haven't really learnt anything for about 18 months. Does anyone know any good courses or sites to use as I find it a useful skill and also quite fun to do. I primarly do python but want to expand out to other languages.
-
Mods if this thread is better in Programming thread then feel free to move it. It just thought it fit here better because im asking about Executeables files that are built into windows. Im wondering does c++, c#, java, extra compile to the same exe, in known you need for example .NET to run c#, and you need visual c++ framework, etc But do all these compile to the same exe insides? Like are they simmilarly structured, compiled to the same exe internaly. Feel free to correct any missspellings or miss wording, im trying to learn this better.
-
Long story short I got bored and decided to type out a simple java idk script or whatever that calculates prime numbers. Simple enough just wanted to do it and then try and optimize stuff as far as I could. Didn't get far into optimizing and am not amazing coder yet but I know the syntax of Java and C. Figured i'd copy it over since i've heard that C is faster than Java. When I run both (same time or just time it when its running) Java proceeds to get further faster. Im not quite sure why am assuming its either because how I copied it made it rather inefficient in C or because Java has better multi threading? Or maybe C's way of printing to console is slower? IDK figured either way I'd learn something by asking why it is here. (Please be polite remember i'm definitely no programmer). Note that the large number inside the while wasn't meant to be reached rather just there to allow easy execution (don't gotta enter anything).
-
Is there a way to Program a Google Home app in C# / Java
January Memes posted a topic in Programming
I have to decide if I want to buy a google home or an amazon Echo but I want to Program my own Apps/Skills, I now that you can make Alexa Skills using the AWS toolkit and C#, which is one of the languages I now good, but I would rather buy a Google Home if there was a way to program it in C# or Java. So is there any way to make an App for google Home without Dialogflow.- 3 replies
-
- google home
- java
-
(and 4 more)
Tagged with:
-
So I got this code from a buddy of mine. And I had to make the part of the servos and the part of the led blinking go parallel. #include <Servo.h> Servo motor1; Servo motor2; void setup() { motor1.attach(6); motor2.attach(5); pinMode(13,OUTPUT); } void loop() { motor1.write(86); motor2.write(99); delay(1200); motor1.write(90); motor2.write(92); delay(1000); motor1.write(95); motor2.write(86); delay(1310); motor1.write(90); motor2.write(92); delay(4000); if (analogRead(A0) > 300) { digitalWrite(13, HIGH); delay(400); digitalWrite(13, LOW); delay(100); digitalWrite(13, HIGH); delay(300); digitalWrite(13, LOW); delay(200); } else { digitalWrite(13, LOW); } } In which I succeeded, see code below. #include <Servo.h> Servo motor1; Servo motor2; unsigned long previousMillis1 = 0; unsigned long currentMillis1 = millis(); unsigned long previousMillis2 = 0; unsigned long currentMillis2 = millis(); void setup() { motor1.attach(6); motor2.attach(5); pinMode(13,OUTPUT); } void loop() { if (currentMillis1 - previousMillis1 >= 0){ previousMillis1 = currentMillis1; motor1.write(86); motor2.write(99); //delay(1200); if (currentMillis1 - previousMillis1 >= 1200){ previousMillis1 = currentMillis1; motor1.write(90); motor2.write(92); //delay(1000); if (currentMillis1 - previousMillis1 >= 1000){ previousMillis1 = currentMillis1; motor1.write(95); motor2.write(86); //delay(1310); if (currentMillis1 - previousMillis1 >= 1310){ previousMillis1 = currentMillis1; motor1.write(90); motor2.write(92); //delay(4000); if (currentMillis1 - previousMillis1 >= 4000){ previousMillis1 = currentMillis1; } } } } } //als de afstandssensor hoger meet dan 300 if (analogRead(A0) > 300) { // gaat het lampje knipperen if (currentMillis2 - previousMillis2 >= 0){ previousMillis2 = currentMillis2; digitalWrite(13, HIGH); //delay(400); if (currentMillis2 - previousMillis2 >= 400){ previousMillis2 = currentMillis2; digitalWrite(13, LOW); //delay(100); if (currentMillis2 - previousMillis2 >= 100){ previousMillis2 = currentMillis2; digitalWrite(13, HIGH); //delay(300); if (currentMillis2 - previousMillis2 >= 300){ previousMillis2 = currentMillis2; digitalWrite(13, LOW); //delay(200); if (currentMillis2 - previousMillis2 >= 200){ previousMillis2 = currentMillis2; } } } } } } else { digitalWrite(13, LOW); } } But the problem is as following: The servos aren't rotating back and forth like they used to do. But now they're rotating at a continuous speed. I hope that you guys can see the problem because I cant. Thanks in advance, Anton
-
Hey Guys, So I have recently purchased a Razer Blade Stealth 8th gen, which is great, loving it so far. I have bought an Alogic USB C superdock ( https://www.alogic.co/alogic-usb-c-portable-super-dock-with-power-delivery-prime-series-black.html ) this model here and have plugged it all in with my mouse, kb and headset, all working fine. However, as soon as I plug my laptops charger into the hub, my peripherals start cutting out, the power to them seems to cut in and out very frequently rendering them useless. I have taken the hub back and had it replaced however this has not helped. Was wondering if there is something possibly wrong with my laptop or am I missing something with the USB C connection here. Cheers for the help
-
Hey guys, hope you can help me out with this code I've been developing in tcl which is the language used for vmd tk console, basically I'm trying to get this function to work. It measures the dihedral angle between 4 atoms from a molecule (trying to get phi and psi angles for a ramachandran plot), the way the function is supposed to work as follows: measure dihed [{{<atomid1> <molid>} {<atomid2> <molid>} {<atomid3> <molid>} {<atomid4> <molid>}}] The atomids are the id number of the atom in the molecule sequence which I'm able to easily get from my script (tested), but when I type the $var where <atomid> are supposed tto be, this is shown by the console: "expected integer but got "$var" measure dihed: bad atom index". I tried to manualy input the atomids, say.. instead of typing {{$var 0} ..... }} I just type {{12441 0} ..... }} and the function works. I've checked some forums and found no help at all. please I need some help
- 4 replies
-
- tcl
- programming
- (and 4 more)
-
Hello everyone. Someone here works or have worked with Chevereto using C#? I'm trying to upload images using Chevereto API but I don't know what code I need to use '-' Thanks a lot,