No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
17 Posted Topics
A few months ago someone figured out how much money to put on a metrocard so that you end up with a zero balance instead of random amounts on your balance that you need to figure out how to even out or just throw away and lose that money. Now … | |
The code is really long so I don't want to post all of it, but I'm posting the part I'm having an issue with. This is part of a fraction class I'm writing. Most of it is working but for there is something wrong with the istream because when I … | |
This code is just a function in a bigger code, but I'm having a problem with the break. I'm not sure I'm doing it right, but basically if the factors are zero, then the program should say the equation can't be factored. It does that, but then continues through the … | |
This is a minor issue that I'm having in a larger program. The program is for factoring a second degree polynomial. The function below is supposed to find the factors, which is does, but let's say a=6, b=1, c=-12 so a*c=-72 and I want the two numbers that will add … | |
This code is supposed to find the nth prime number (n being input by the user). I have the code to calculate whether a number is prime or not, but I don't know how to get the code to display the nth prime number. #include <iostream> using namespace std; void … | |
I'm getting an error with this code. Both the findMax and findMin lines in main say "Invalid conversion from 'int' to 'int*'". What does it mean? #include <iostream> using namespace std; int findMax(int[],int); int findMin(int[],int); int main () { int max, min, x; findMax(max,x); findMin(min,x); return 0; } int findMax(int … | |
I wrote this code to change all lowercase letters in a string to uppercase. That works, but I also want it to go the other way around and nothing I tried is working. #include<iostream> #include<string> #include<cctype> using namespace std; string change(); int main() { change(); return 0; } string change() … | |
This code is supposed to output a hollow square (size and symbols to be determined by the user), but it doesn't do that. First of all, if I set the size of the square to be 5, it outputs 10-5 sets of both symbols. Also the right column is in … | |
I wrote this code to sort 3 integers, but I can't figure out how to add the 4th integer. #include <iostream> using namespace std; int main () { cout << "Enter 4 integers: "; int a, b, c, d; cin >> a >> b >> c >> d; if (a<b) … | |
There is something wrong with this program. The code is ok, the program runs, but it stops after asking the user how much their income is. Where am I going wrong? (Sorry, it's really long, but I can't figure out where the problem is) #include <iostream> #include <string> #include <cctype> … | |
Is it possible to loop an if-else statement? How would such a thing be coded. Basically, this code allows the user to enter a value for a month. If it's not from 0-12 it asks the user to enter a new value. How could I get that to go through … | |
I'm receiving this error when I'm trying to run my program: Program received signal: “EXC_BAD_ACCESS”. Does anyone know what this means? | |
I'm writing this program to calculate the best fit line. It's not finished. I'm doing it step to step to make sure it runs so I don't get lots of errors and totally freak out at the end. Right now it runs fine, but something is really off with the … | |
I wrote this code for a homework problem. The question asks for the inputs to be an array representing a polynomial along with the degree of the polynomial and the value of x. Then it has to return the derivative of the polynomial. Until I ask the program to output … | |
I wrote this code for an assignment that asked to create a program that calculates and displays the average of any amount of real numbers. The program is supposed to ask the user how many numbers they want to enter and then use a loop to ask the user to … | |
I'm writing some while loops but I feel like there is a better way to write them. [CODE]int i=3; while (i<31) { cout << i << " "; i+=3; } //this one is for the first 10 terms of a sequence starting with 3 and adding 3 each time. int … | |
I wrote this code for a homework problem. The instructions say that there is a list of phone numbers that were reversed (ex. 6463124137, needs to be 7314213646) and the program needs to reverse them back. My professor also included this hint: [I]"Hint: One way to reverse the number would … |
The End.