139 Topics

Member Avatar for
Member Avatar for Labdabeta

I am really confused as to the purpose of the unary + operator. What in the world does it do? I have tested it and it doesn't return the absolute value. Does it just return the operand? And if so what purpose is it?! (I mainly care about integer types)

Member Avatar for mrnutty
0
296
Member Avatar for umair jameel

public class First { public static void main(String[] args) { int a; a=EasyIn.getInt(); System.out.println(" the value of a " +a); }} // this code is showing an error of " easy In " not finding symble. // help me

Member Avatar for NormR1
0
800
Member Avatar for dgreene1210

im getting the error below and I can't figure out why this isn't working. Ive looked at this for 2 days not knowing. I'm hoping a fresh set of eyes on it might help. main.c:13: warning: assignment makes pointer from integer without a cast [CODE] //HEADER FILE: #include <stdlib.h> #include …

Member Avatar for Ancient Dragon
0
712
Member Avatar for //Gonz

Hello daniweb chums I once again cannot seems to get a simple bit of text box validation working I am trying to detect if a first name entered contains a number by converting the text box text into a char array and then convert each character entered (using a for …

Member Avatar for Antenka
0
259
Member Avatar for NickPatton

I'm working on a program that takes 5 integers from input and then prints out the smallest and second smallest of those integers. The program correctly outputs the smallest number but the program often outputs the second smallest number incorrectly because of ordering. For example, if I enter 33, -6, …

Member Avatar for mazzica1
0
3K
Member Avatar for matharoo

I am trying to store the numbers of a text file into a 2D array.. Here's the text file: 1 2 3 2 3 4 4 5 6 But i get the error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 at BankerAlg.main(BankerAlg.java:30) Process completed. Here's the code i made: [CODE] import …

Member Avatar for matharoo
0
2K
Member Avatar for Matth963
Member Avatar for Matth963

[CODE]int numdigits(int num){ int len = 0; while(num >= 10){ num = num/10; len++; } return len; } [/CODE] This algorithm is used to count the number of digits but I can't understand it. Someone explain it to me please :D Thanks

Member Avatar for hfx642
0
103
Member Avatar for Muhammad Anas

Hi, I am trying to write a program that will separate the digits of a non-negative integer and will print them each two spaces a apart but I have to avoid using arrays. For example if input is: 12345 then output should be: 1 2 3 4 5 I have …

Member Avatar for Muhammad Anas
0
3K
Member Avatar for tedman102

I have made a program to make a rectangle in a text matrix. It begins asking for width and height. The variable must be greater than 2 and a whole number. The only problem is if a user enters a character instead of a number, or a decimal instead of …

Member Avatar for Narue
0
262
Member Avatar for maynardjk13

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 …

Member Avatar for maynardjk13
0
230
Member Avatar for Alex Starkov

Hi! I have to write the programm, which will receive any number (at sec) and calculate it to weeks, days, hours, minutes and sec; for e.x. 4102 sec ---> 1h 8m and 22s The problem is that it's forbidden to use atoi(), scanf() and simmilar functions. Insead of them, I …

Member Avatar for Alex Starkov
0
245
Member Avatar for Mike Askew

Hi all, My program is proving Kaprekar's Constant - 6174. To do this I will need to store values exactly how they come out without losing any preceding 0's which int has a habit of cutting off. For example: Number to store exactly: 0147 Int stores: 147 A googling session …

Member Avatar for Mike Askew
0
138
Member Avatar for George_91

I've this quicksort code, and it compiles. The thing is, I don't know how to give random values (integers) to the vector. The program should ask for the vector's size and then create the x random integers so it can apply the quiksort method. [CODE]#include "stdafx.h" #include <iostream> #include <vector> …

Member Avatar for George_91
0
2K
Member Avatar for jonjacob_33_0

[CODE]def toNumbers(strList): for char in strList: return strList[0:len(char)] def main(): sttr = ['120','125'] print(toNumbers(sttr)) main() [/CODE] The output is: ['120','125'] I want the output to read: 120 125 <-- without the brackets and quotes I'm supposed to take a list of numbers (as strings) and simply return the same numbers …

Member Avatar for JoshuaBurleson
0
818
Member Avatar for infantheartlyje

Hi folks, I want to check two dates. The date format [MMDDYYYY]. for e.g., 01252000 . I want separate the day , month, and year into a integer. How can i do this?

Member Avatar for infantheartlyje
0
336
Member Avatar for Curtisq

So my problem is writing a program that asks the user to input a number wich is stored with scanf then print the binary representation of that number in 32 bits, as in if the number is 1 i would need 31 0's and a 1. [CODE]#include <stdio.h> void dec_bin(long …

0
102
Member Avatar for James19142

in this program i'm writing, i seem to keep getting rounded down values. At first i though it was because i was declaring my return variable as an integer so i made sure i wasnt doing that and changed all number variables in the class to doubles to ensure i …

Member Avatar for Fbody
0
158
Member Avatar for bentom123

Hi, I currently have a form with about 20 textboxes on, labeled Textbox1, Textbox2 and so on... I would like to know how to get the data from any one of these textboxes from an integer. [CODE] Dim text as String text = "Textbox" & RandomInteger & ".Text" msgbox(text) [/CODE] …

Member Avatar for Unhnd_Exception
0
3K
Member Avatar for pythonhelp11

I need to create a code that will extract the dob from a array of string, like this [iCODE]finddob(["name:bob grade:a dob:1980","dob:1976 name:kate grade:c"])[/iCODE] [CODE]def finddob(listofstrings): recordnum = 0 while(recordnum < len(listofstrings)): yearstart = listofstrings[recordnum].find("dob:") + 4 yearend = listofstrings[recordnum].find(yearend) year = int(listofstrings[yearstart, yearend]) if(year > 1990): print("Is over 21") else: …

Member Avatar for woooee
0
423
Member Avatar for TrustyTony

The need for efficient storing of IP numbers came up in discussion thread. With help of this conversion to/from the 32 bit numbers that IP numbers (the old ones) represent I could push the time of finding unique IP numbers from 10 million random numbers down to under two minutes …

Member Avatar for mrkbbk
0
803
Member Avatar for anuj_sharma

Hi, I am getting an error "Illegal Start of Expression" on the following code: [CODE] obj.NoOfJumps(1, 2, 3, {1,2,3}); [/CODE] Here, NoOfJumps is a method defined in a class which does not have the main method. This method accepts 4 arguments namely 1)Integer 2)Integer 3)Integer 4)Integer Array Can someone please …

Member Avatar for Ezzaral
0
145
Member Avatar for ben1996123

Hello, I just downloaded the [url=https://mattmccutchen.net/bigint/]big integer library[/url], and I want to use it in my prime number checking program. I downloaded the zip file and got a bunch of .cc and .hh files. I need to know what to do with the files, where I should put them, and …

Member Avatar for ben1996123
0
232
Member Avatar for rhuffman8

I am working in an older version of Python (2.6, I believe). I cannot update to the latest version because it is not currently compatible with the other program I need the code to run with so, unfortunately, the "decimal" module is not available to me (as far as I …

Member Avatar for Gribouillis
0
233
Member Avatar for sunnynight

Dear Friends, This is my homework, I have a text file containing the following content: [QUOTE]0 12 1 15 2 6 3 4 4 3 5 6 6 12 7 8 8 8 9 9 10 13[/QUOTE] I want to read these integers from data.txt file and save the two …

Member Avatar for hfx642
0
193
Member Avatar for thetwig

hey guys heres a portion of my code, im trying to validate a users input of price and then convert it to cents before doing some other calculations. Im having problems with my validation still somehow allows letters if they are not the first digit entered. For example, a2 is …

Member Avatar for WaltP
0
212
Member Avatar for kutuup

Hi, I'm working on an assignment where we have to have a client and server sending each other an integer that represents a noughts and crosses board. I had it working by simply sending back and forth the entire NoughtsAndCrosses class, but now we need to do it just using …

Member Avatar for kutuup
0
202
Member Avatar for stupendousomega

I have a user input an integer... But if it's really long, it throws an exception and starts looping infinitely. How would I make it cut the number after the first 7 digits and only use that? Like, if I inputted 654897654321648435435135813513843513543514, it would only accept 6548976. Please help.

Member Avatar for mrnutty
0
210
Member Avatar for Youg

Hi, I'm almost done with my coding and I'm trying to implement blocking the user from putting anything but numbers into one textbox and then autocaps'n everything put into another. I've been looking through the web and can't find anything to point me in the right direction. Also, I can't …

Member Avatar for Youg
0
196
Member Avatar for goocreations

Hi I'm looking for an efficient way of converting an array of integers to an array of doubles. Currently I'm doing this: [CODE]int *a = new int[1000]; //And then assign values to the indexes double *b = new double[1000]; for(int i = 0; i < 1000; i++) { b[i] = …

Member Avatar for mrnutty
0
5K

The End.