Hi, So how exactly do we take the length of an int array? Lets say that there is an array called int nums []={2, 1, 2, 3, 4}; Is there a function that can be used to find it?

Member Avatar
Member Avatar
+0 forum 8

Hello, I'm in a beginning Java class, and I am lost :( My homework calls for me to write a program that takes an integer (of unknown length) and prints it one digit per line, like: 5 6 9 8 6 4 3 I have been googling this for hours to no avail. The code below is something I tried based on my failed attempts to google the correct method and it is returning 11 errors. I have also tried System.out.println with charAt, and that didn't work for me either. I have the most basic of knowledge and am not …

Member Avatar
Member Avatar
+0 forum 17

This will take a value in EAX or AX, convert to ASCII hex with optional padding and upper or lower case This example would yield "---fc103a" push word 0x222d ; 32 bit conversion, padd output with '-' push word ASCPntr ; Pointer to end of conversion buffer push 0xfc103a call I2H inc ax ; AX points to actual first character AX pointing to 1 character before actual beginning allows for successive calls with that pointer so essentially one could convert a 1,024 bit value with this algo.

Member Avatar
+0 forum 0

Hello , today I was developing a short url system and I created this class to help me encode / decode integer (id) to small string. That way for example “Ac” means 3674 . Because I believe that it may be helpful to others too I share it here. Notice that in the constructing string each char can be present only once. Example of usage: $numCode = new Model_Utils_Numcode("4fFiV8kRTvm5MPNDcyO1dg7lr20Qtn3X6pKLZUqaEsxCwubGYIzhSWJojHeA9B"); $num = 3674; $encoded = $numCode->encode($num); echo "<br/> $num encoded = $encoded"; // 3674 encoded = Ac echo "<br/> $encoded decoded = ".$numCode->decode($encoded); // Ac decoded = 3674 Class: class Model_Utils_Numcode …

Member Avatar
Member Avatar
+2 forum 5

Hello. I have a list: mylist = [2,4,4] How can i take number 244 out from the list? Something like: number = 244 Here 244 is integer.

Member Avatar
Member Avatar
+0 forum 6

Hi. I need help to write one program in Assembly Mips. << read the characters typed by the user and store these characters a string. This string is later converted to an integer. If the user tries introducing non-valid characters (that is, other than the numerals 0 to 9) the program "complaining" and start all over. again.>> What's is wrong? .data text: .asciiz "\nEnter a number : " text2: .asciiz "\nThe value entered was: " text3: .asciiz "\nEntered an invalid character" val: .space 160 .text .globl main main: li $v0, 4 la $a0, text syscall main2: li $v0, 12 syscall …

Member Avatar
Member Avatar
+0 forum 1

## Background ## Hi All, I 've been playing around with colour (color!) formats and needed to create a class for converting different formats, so I thought I'd share it. It seems to work quite well and accepts a number of different convenient formats. The class allows the conversion between HSL, HSV, RGB, CMYK, HEX (base16), Integer (base10) and 'HTML color names'. I found the formulae for conversion from pseudocode in the following locations: http://www.rapidtables.com/convert/color/ (great colour references!) http://stackoverflow.com/questions/15202079/convert-hex-color (for the sscanf method) It should be noted that conversions involving CMYK can only be approximate as there is no absolute …

Member Avatar
Member Avatar
+5 forum 4

// random number generator var theDecimal = 0; function newProblem(){ theDecimal = Math.floor(Math.random()*256); //math.floor chops off decimals and rounds document.getElementById("startNumber").innerHTML = theDecimal; }

Member Avatar
Member Avatar
+0 forum 2

Hello everyone! I have tried again and again to get this to work using multiple suggestions from the Internet. I am trying to convert an int[] to an Image object. I am getting the array using a PixelGrabber object: int img1_1d[] = new int[img1_w * img1_h]; PixelGrabber grab1 = new PixelGrabber(img1,0,0,img1_w,img1_h,img1_1d,0,img1_w); try { boolean r = grab1.grabPixels(); if (!r) System.out.println("Pixel grabber ERROR"); } catch (InterruptedException e2) { e2.printStackTrace(); System.exit(1); } I am attempting to create the Image object using this code: public static Image getImageFromArray(int[] pixels, int width, int height) { BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_BINARY); WritableRaster raster …

Member Avatar
Member Avatar
+0 forum 3

How do i make an auto-incrementing column? Heres my pseudocode/sql attempt How do you make an auto-incrementing ID for a record c.execute('''CREATE TABLE <tableName> ( <columnName> <aut incrementing??!!>, <columnName2> text, <columnName3> text, <columnName4> text ) ''')

Member Avatar
Member Avatar
+0 forum 1

My UPDATE vb.net code below displays this error message:conversion from string "UPDATE tblstaff SET fName='name' " to type 'integer' is not valid.Microsoft.visualBasic conn.Open() If conn.State = ConnectionState.Open Then com = New OleDb.OleDbCommand("SELECT *FROM tblstaff ") com.Connection = conn Dim cb As New OleDb.OleDbCommandBuilder(da) da.Fill(ds, "Eeestaffinfo") Dim sql As String = String.Format("UPDATE tblstaff SET fName='{1}', lName='{2}', dob={3}, eMail='{4}', mobileNo='{5}', designation='{6}', address='{7}', fAppointment={8}, fpromotion={9}, lpromotion={10}, publications='{11}', position='{12}', leaveStatus='{13}' WHERE pfNumber='{0}'", txtPfNo.Text, txtFname.Text, txtLname.Text, Format(dtpDob.Value, "dd/MM/yyyy"), txtEmail.Text, txtPno.Text, txtDesignat.Text, txtAddress.Text, Format(dtpFappoint.Value, "dd/MM/yyyy"), Format(dtpFpromo.Value, "dd/MM/yyyy"), Format(dtpLpromo.Value, "dd/MM/yyyy"), txtPublicatn.Text, txtPosition.Text, txtLstatus.Text) com.CommandType = sql com.CommandType = CommandType.Text com.Connection = conn com.ExecuteNonQuery() com.Dispose() 'conn.Close() MessageBox.Show("Good") End …

Member Avatar
Member Avatar
+0 forum 10

/* EXCHANGE THE INTEGER VALUE WITHOUT USING THE THIRD VARIABLE */ #include<stdio.h> void main() { int a,b; printf("enter the two integer variabe \n"); scanf("%d,%d",&a,&b); //exchange the value of a to b ,b to a without using third variable a=a+b; b=a-b; a=a-b; printf("%d%d",a,b); getch(); } /*EXAMPLE: A=3,B=10 A=A+B; // A=3+10=13 B=A-B; //B=3-10=3 A=A-B //A=13-3=10 */

Member Avatar
Member Avatar
+0 forum 12

Ok I'm just looking for a cleaner way to achieve my goal here, if there is one and if this is not much of a satisfactory method. The goal is to accept an integer from a user using JOptionPane.showInputDialog. A brief example of what I'm currently doing do { check = true; try { num = Integer.parseInt(JOptionPane.showInputDialog("How many items do you need to list?")); } catch(NumberFormatException nfe) { nfe.printStackTrace(); check = false; } }while(!check); Just curious for better methods, faster, cleaner etc. Thanks in advance

Member Avatar
Member Avatar
+0 forum 6

Hello Good day. Here is the problem I am trying to solve. I have a table as seen below. ![232465554203149acd8363d3a4a127ae](/attachments/large/3/232465554203149acd8363d3a4a127ae.jpg "232465554203149acd8363d3a4a127ae") My GOAL: Columns A through G are going to be filled with integers. (I have already created an integer model so that these cells only take integers). As the cells in that range are filled, the Totals column will decrease in number until it reaches zero. So far I have managed to use a TableModelListener to respond to the changing cell values. What I wish to do now is to prevent a cell, *that is being edited*, from *accepting* …

Member Avatar
Member Avatar
+0 forum 14

Hi, I am trying to write a program which read a certain input in a particular format and then gives an ouput. I wrote a code to read the file. Input is something like this. X 20 60 80 90 X 78 98 97 96 X 34 35 43 23 Y 76 87 34 Y 65 76 72 Z 13 70 39 So my reading function read the input and then it counts the number lines with X and Y. Now, when I wrote two different funcions to read X and Y lines. When I am finished reading the X …

Member Avatar
Member Avatar
+0 forum 4

Hi Everyone, I have a program that takes data in a two dimensional array, performs simple calculations, and then writes the data to a file. When I call the function that calculates and writes, I get an error on the two dimensional array stating: "argument of type 'int' is incompatible with parameter of type 'int(*)[5]'." .I am not sure why this suddenly changed to italics....ok but I am not sure why this error is happening. //Call writing function storeProportions(output, dropsOf[3][4], totals, numFailed); //located in main //Function prototype void storeProportions(ofstream output, int values[][NUM_COMPONENTS], int totals, int numRows); //2d array in main …

Member Avatar
Member Avatar
+0 forum 15

Hello Friends, Can someone please advise me on how to print an array inside of a GUI text field? Thank you, Jim Here is some of my code. /** This private inorder method recursively traverses a binary tree in inorder. @param btree The root of the tree to traverse. */ private void inorder(AVLNode btree) { int [ ] arr = new int[10]; if (btree != null) { inorder(btree.left); arr[k] = (btree.value); inTextField.setText(arr[k]); //This gets me an error message. k++; inorder(btree.right); } }

Member Avatar
Member Avatar
+0 forum 3

Hi everyone, I need to use integer that is typed into textbox to do some math functions. here is what i have: Private Sub btnDivide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click dim x as integer dim y as integer dim tbox as integer tbox = (Textbox1.Text) x = (y / tbox) * 100 if (x >= 50) then 'do something end if End Sub when i press button it keeps saying that conversion from string "" to type 'Integer' is not valid! how do i fix it? i've tried tbox = CInt(Textbox1.Text) and tbox = Ctype(Textbox1.Text, Integer) …

Member Avatar
Member Avatar
+0 forum 1

I have problem reading file form command line. I am trying to do " abcd: ./rev < numbers", but it gives me an error: ./rev < numbers Usage : ./rev FILENAME Here is the code: #include <stdio.h> #include <stdlib.h> void reverse(FILE * file) { int fscanf_return_value; char x; /* read a char */ fscanf_return_value = fscanf(file,"%c",&x) ; if(fscanf_return_value == EOF) { //fscanf returns EOF as the END OF FILE return; } reverse(file); //Get the next char //do something with the char e.g. print putchar(x); return; } int main(int argc, char *argv[]) { int i; FILE *fd; if (argc!=2) { printf("Usage …

Member Avatar
Member Avatar
+0 forum 4

This procedure is called just before the answer is written to a binary file to ensure it is in the correct format. It works but I need it to repeat until it is an integer. I was trying to use a 'repeat','until' but wasnt sure what the 'until' condition woudld be. At the moment it displays the message and then carries on regardless. Procedure ValidateAnswer; begin try ValidatedAnswer:=StrToInt(QuestionnaireForm.Answer.Text); except ShowMessage('Answer must be an integer'); end; end; Thanks!

Member Avatar
Member Avatar
+0 forum 3

In actionscript 3.0, when working with Arrays what is the difference between INDEX and KEY?

Member Avatar
Member Avatar
+0 forum 1

User is supposed to type an input, and if it's not an integer, the user needs to type another. This repeats 3 times for 3 inputs which go inside an array. The integer checking works, but the problem is that when i display the 3 integers, they are all the same number (the first correct input). Idk what's wrong. I've tried cin.clear() and cin.sync()... for(int i=0;i<3;i++){ cout<<"Enter your "<<text[i+6]<<": "; cin.sync(); cin.clear(); cin>>inInt[i]; if(!cin){ cout<<"\nPlease enter a valid integer."; i--; system("pause");} system("cls");}

Member Avatar
Member Avatar
+0 forum 1

I want to create an integer generating program where the user enters any number in TextBox1 and TextBox2 and presses the Generate button and in another textbox the integers shows up. REFER TO THE LINK to see what I mean. [Click Here](http://picturepush.com/public/11671143)

Member Avatar
Member Avatar
+0 forum 1

Hello All!! I have an assignement that I am working on and for some reason I cannot for the life of me recall how to do something so simple lol. The directions are too "Write a function named Exam, which takes one argument n where n>2. Your function creates a list (list1) of n random integers in range (1,5) and print all elements of list1 on one line. So far what I have is : def Exam(n): import random random.randrange(1,5) I am not sure where to insert the n>2 and even really what it means. If anyone can assist or …

Member Avatar
Member Avatar
+0 forum 1

how do you manually convert a multi digit ascii string into the hex equilavent of a decimal integer with out using a C library function. For instance If I have a small program asking a user to type into the keyboard a decimal number and lets say they type in 64357, and if this number is base 10 or decimal, the characters that get sent out a standard uart port would be the ascii equilavent of 0x36, 0x34, 0x33, 0x35, 0x37, on the receiving side of this uart, i would then need a 5 byte (unsigned char) array how do …

Member Avatar
Member Avatar
+0 forum 4

Hi I have trouble with implementing a dynamic two dimensional pointer array on allocating memory for it. I tried it this way but not sure if it's correct. The array should contain pointers to heap allocated **Integer** objects const int size = 10; Integer *** twoD; twoD = new Integer**(); for(int i = 0 ; i < size ; i++) *twoD[i] = new Integer(); for(int j = 0 ; j < size ; j++) twoD[i][j] = new Integer(); Any help will be appreciated!

Member Avatar
Member Avatar
+0 forum 5

How to add an integer no to a date so tat i can a new date foe ex: date=10/11/2012 no=5 newdate=15/10/2012 **Any body plz help to solve the problem**

Member Avatar
Member Avatar
+0 forum 5

Let's say I have a method called 'test' which should return the arraylist called 'theList' containing X number of Integers. How would I do that? public static void test(){ SOME CODE ... return theList } What should 'void' and 'theList' be replaced with in that code to make it work?

Member Avatar
Member Avatar
+0 forum 2

I need to design an application that determines and prints the number of odd, even, and zero digits in an integer value read from the keyboard. This is what I have so far. public static void main (String[] args) { int odd=0, even=0, zero=0; Scanner scan = new Scanner(System.in); int num = scan.nextInt(); String numS = Integer.toString(num); int digits = numS.length(); for (int i = 0; i < digits; i++) { if (numS.indexOf(i) == 0) { zero++; } else if (numS.indexOf(i) % 2 == 0) { even++; } else { odd++; } } System.out.println("The number of odd digits are: " …

Member Avatar
Member Avatar
+0 forum 3

I am very new to C and I am hoping for some pointers. I am attempting to take an input of 7 integers of an array and search through them to see if any number appears only once. Here is what I have so far #include stdio.h #define ARRSIZE 7 int main(void) { int intarr[ARRSIZE], i, target; printf("Please input %d integers :", ARRSIZE); scanf("%d", &target); for(i = 0; i<ARRSIZE; i++) { scanf("%d", &intarr[i]); } { if(i < intarr[i]) Here is where I become lost. I get how to search for it. If number x appears in the array, dont count, …

Member Avatar
Member Avatar
+0 forum 8

The End.