578 Topics
| |
For a school project, I am trying to make a program that gets user input and finds the factorial of the input. I wrote this bit of code and got tons of errors. Help, anybody? [CODE]import javax.swing.*; import java.awt.*; import java.io.*; import java.util.*; class TestFactorial { public int x = … | |
Practicing C++ and here is two of the practice problems I pulled from the FAQ And practice post. Just want feedback and issues with the way I wrote these. Simple Calculator [CODE] #include <iostream> #include <string> #include <sstream> #include <stdlib.h> using namespace std; int main(void) { //cout << string(50, '\n'); … | |
i need to sum anything that is input in input form numbers. And this has to be in order like 5,4,3 and then it has to sum like 5+4+3 = 12. Can anyone help? I came as far as the code shows above. this is the example of how it … | |
The program should calculate the average of the values stored in the [B]rates[/B] array. It then should display the average rate on the screen. Display the average with two decimal places. Complete the program using the [B]for [/B]statement. Save and then run the program. Complete the program and also have … | |
I'm working in the confines of a binary search tree and an AVL tree, doing some operations to find different statistics for these trees when given large random values. For instance some of my functions include finding the average leaf node depth, find the shallowest leaf node, etc. My question … | |
I have an array [x,y] where the values of x is ascending and the y values are random. I would like to sum all of the y values together when the x values are within a certain range. I can't show you any code as i dont even know where … | |
Hi, I have javascript which counts seperately every time 2 seperate buttons are clicked, this then outputs the amount on the same page. This works, however I am now trying to add a third value to output on the page which is the total of the clicks which i would … | |
I made a program to find primes, but it can't find any prime less that 7(e.g. 2, 3, 5) any ideas? [CODE]import math from math import sqrt x = 1 y = raw_input("What number do you wish to find all the primes below? ") y = int(y) while x < … | |
Hello. I have a piece of code currently where I have a JFrame that I have removed the title bar and borders etc from using .setUndecorated(true). I have tried a number of ways with no success to make this window draggable by it's client area. [CODE] JFrame f = new … | |
Need some guidance with this program. Never had experience with sentinels so I'm not sure where to start to calculate the multiple grade inputs. [B]Requirements:[/B] [LIST] [*]Sentinel needs to be used to indicate when there are no more students to process [*]Will read data about a student one at a … | |
i know this is a stupid question but i just don't know :\ if i have 2 time variables [CODE] a = 00:00:12 and b = 00:00:05[/CODE] how would i add them together to make [CODE] c = 00:00:17 ?[/CODE] i get the data from the database in this format … | |
Hey All... This query is waaaay outside my skill set so I can't even fathom how to do this other than the "brut force" method and that's way to slow for my purpose (a mobile app). I have two tables, `Categories` and `Articles`: `Categories` has: `id`, int auto-increment `name` text … | |
I'm trying to make a Palindrome program, that basically returns whatever you enter, just backwards. For some reason, the cNewArray is not only couting the original array backwards, but also the original array. For example if I enter "Hello" it returns "Hello = olleHHello". I'm very new to referencing pointers … | |
A number is called a proper divisor of N if M < N and M divides N. A positive integer is called perfect if it is the sum of its positive proper divisors. For example, the positive proper divisors of 28 are 1, 2, 4, 7, and 14 and 1+2+4+7+14=28. … | |
[CODE]#include<stdio.h> #include<string.h> #define SIZE 100 int main(void) { int array[SIZE], i, n, j, sum=0; printf("Enter some integers:"); for (n=0;n<100;++n) { scanf("%d", &array[n]); if(array[n] == -1) { j=n; break; } j=100; } for(j<=100;i>j;++i){ printf("%d", array[n]); } for(j=0;j<n;++j){ sum=sum+array[n]; printf("The sum is %d\n", sum); } return (0); }[/CODE] [I]Im trying to output … | |
I need help with a programing assignment for my CS 2 class, the task is to check rather a user inputted string is a palindrome meaning it is the same forwards as it is backwards. I have most of the program working, I input a string then copy it and … | |
Hello everyone, my assignment is to calculate each student's test average and final letter grade from a class of 20 students with 3 tests. The scores for each test are located in the text files that I am attaching. I have worked on this code for some time now, but … | |
Hey, Im having trouble writing a function that will take a limited running average from a file. the running average works just fine, its just when i try to limit the input, i just come out to inf. could it possibly be that im using a static double for the … | |
Hello everyone, :) I have exercise for class that I can't complete, I don't understand why my loops aren't working The question--- Write code that will print a multiplication table for 10 positive integers across the columns and 10 positive integers down the rows. Prompt the user for the starting … | |
the question asked me make a program that would find opens an read a txt file and calculate or display the following. - the number of numbers - sum of all the numbers in the file (running total) -average of numbers in file the .txt file just has 100,200,300,400,500,600,700 each … | |
Hello Guys! I need help for an assignment. Somehow my code will not correspond to what I'm looking for. I'm having a hard time to find what the problem is. If you guys can please help me, I'll be more than appreciate !!!!! [I]1) Create a program that will read … | |
below is my current code for a math game i'm having problems creating the answer checking part of it, any assistance is appreciated. [code] import javax.swing.*; import java.util.Random; import java.awt.Button; import java.awt.Color; import java.awt.Dimension; import java.awt.Event; import java.awt.event.*; import javax.swing.*; public class MathPanel extends JPanel { // Declares Labels and … | |
Greetings! I've been working on this program for the past couple of hours now, and I cant seem to get it right. I'm supposed to write a program that reads in integers from a text file, and then find the sum of the integers. The problem I'm having is with … | |
Here is class that can be fed directly from split stream like one number per line file (or [URL="http://www.daniweb.com/software-development/python/code/321725"]generator producing 'words'[/URL] from multiple numbers per line). | |
hi, I already know how to use setprecision but the function wont let the round go up past 16. [CODE]#include<iostream> #include<stdio.h> #include<math.h> #include<iomanip> using namespace std; int main () { double pi = 3.14159265358979323846264338327950288419716939937510; cout << setprecision(50) << pi << endl; system("pause"); } [/CODE] the output is just 3.1415926535897931 the … | |
I've searched all over, but Have not been able to find exactly what I need help on. I am creating a program that takes user input of a word and determines if it is a Palindrome or not....the catcher is I need to use stacks. They are confusing to me. … | |
Howdy! I've searched the forums and Google for ideas but all the information/advice I found was either not helpful or inaccurate. So, perhaps someone here can help point me in the right direction. I'm heading off to University next year but, before I do that, I'd like to study some … | |
I am facing problem on sum of dynamic array value. For example : [B]tablename : totalamt[/B] ref_no | Amount 1 | 58 2 | 12 3 | 11 i am using check box to select the ref_no. now i am selecting 3 check box now and submit it. Now it … | |
The homework question said to rearrange statements and remove part of code that made it calculate incorrectly. I'm lost on this and have been searching multiple places and trying different things. This is a beginning C++ class, too, so, for homework in the first half I can't very well be … | |
[CODE]#include<stdio.h> int main() { int n,i,c=0; printf("\nEnter a no:"); scanf("%d",&n); for(i=1;i<n;i++) { if(n%i==0) { c=c+i; } } if(n==c) printf("\nPerfect no."); else printf("\nNot a perfect no."); }[/CODE] |
The End.