Homework Statement
I am writing a program so that a user can input up to ten integers and then sought through and print the smallest from that input
i.e. enter in up to ten integers: "7 5 6 19 4 8"
the smallest number is 4
Homework Equations
The Attempt at a Solution...
I have an array of 3 known elements.I know that 2 elements of them have the sum of 100 and I need to find the location of the two elements which have this sum
ex.
A[3]
5 25 75
the solution for this prob.
is second & third location
Thanks,
Hey all,
So declaring integers successively in memory (using .word) in an array is all well and understandable. Since an integer is 4 bytes in length, as is a memory word.
For example:
.data
x: .word 2, -13, 24, 123 #initialization of elements 0 to 3 of array x
However, how would...
halfway through my code so its a bit of mess but this is simple what i need to do.
I have a JLabel array of 6 labels.
a random number is generated, its then split into its digits into a 6 element array of integers. now i need to update the Jlabels with the integer array of digits.
my...
The following code block is in C++ Everything is inside the first for loop.
for( int i=0; i<=2; i++)
{
int a[3]={0};
for(int j=0; j<3; j++)
a[i]=j;
for( int i=0; i<=2; i++)
cout<<a[i];
cout<<endl;
}
basically I am trying to get the screen to output...
I am working on an app that needs to access an array of pixels from a picture after it is taken. The main Activity is below. I have a good amount of java experience but extremely limited experience with images past displaying them on the screen. I see the byte array being passed to the picture...
hello everyone
I know that dynamic array is not supported in Verilog and Quartus. I want to know does anybody has an idea or algorithm to use instead of dynamic array. I mean I am searching for something that works instead of a dynamic array.
thanks
I have one main program where I have calculated some array, say A(i,j)
If I want ot use the values in subroutine, and calculate some more values and give back the result to main program, how my syntax should be?
I tried this way. Its not working.
program a...
I want a code in MATLAB that produces A\{4}, where A={3,6,1,-3,4,8}.
I know for instance:
A=[ 3 6 1 -3 4 8];
A(5)=[]; produces
3 6 1 -3 8
But what should I do if I don't know the index (in this case 5) for the entry '4'; and I want to get
[ 3 6 1...
Homework Statement
Error:
warning: HEAP[Happy Birthday.exe]:
warning: Heap block at 006E15A8 modified at 006E1688 past requested size of d8
My Struct:
struct student { // Defines a student.
char firstName[NAMELENGTH], lastName[NAMELENGTH];
int day, month, year;
};
My Code...
Hello all,
I need to make a magnetic surface using neodymium disc magnets... the purpose for the surface is to hold on to a sheet of ferrous material, as strongly as possible.
I tend to want to assume that a checkerboard array would be best... alternating the poles of the magnets in the...
I have a .txt file with 100,000 integers from 1-100,000, with each integer in a newline. I am facing a problem in using the fgets function. How do I read the integers into an array?
#include <stdio.h>
//Program to count number of inversions in an input file of integers using Brute force...
Homework Statement
I have a matrix that contains zeros but it may contain also ones. For example:
ID=[1 0 0 0;
0 0 0 0;
1 0 1 1]
I'm trying to replace all the ones by zeros and all the zeros by elements of an array EA going...
Hi all !
I am new to fortran. Please see the following code. It is a simple code to pass an array to a subroutine and print it, but doesn't behave that way:
program exp_realloc
implicit none
integer,allocatable,dimension(:,:):: array
integer::i,j...
Homework Statement
I need to write a program which calculates the sum of all the numbers of an array of unknown length. The input of a[i] ends when a's value is the letter 'D'.
Homework Equations
The Attempt at a Solution
program homework;
uses wincrt;
var
a:array[1..100] of integer;
S...
Homework Statement
If I am given a regular, single dimensional array in Java, how do I search for an element in it, and then how do I get the index of that element?
I have been trying:
int largest; //some number that has been predetermined in earlier code
int index3 =...
Hi everybody;
I'm not programmer or computer expert, but during working with my thesis got serious problem with my program seemingly about big size of matrices. I'm working with meshes and using Fortran to analyze entire of my mesh including nodes and elements. The biggest size of my matrix has...
I try to write a small program to allocate a variable in small subroutine and I've passed it, now i allocate array in a loop or many loops but i don't have any ideas about it.
Has anyone done like me , can share some experiences ??
I am writing a code to calculate and to operations with a large set of matrix elements, indexed by four numbers.
I am also writing these subroutines within a much larger code structure, so I do not have total freedom to modify the objects I am using.
I am trying something like this, which...
I'd like to create some test data to read 2-dim arrays in f90 with namelists. Suppose I have this in the main program:
integer, dimension(2,3) array_in, array_out
namelist /WW_ARRAY/ array_in, array_out
...
Open(unit=WW_ARRAY_infile, file="WW_ARRAY_in.dat", status =...
Homework Statement
I am trying to rotate a 2D array of type string. I am not sure what the problem is with my function. Flipping does occur but for some reason, it's not by 90.
Homework Equations
The Attempt at a Solution
The program consists of a function and the main. Here's...
Homework Statement
I am attempting to transfer the data from a file into a 2D vector array. The data look like this:
1 2 3
4 5 6
7 8 9
However, the dimensions must be detected dynamically.
Homework Equations
The Attempt at a Solution
There are two files in this code, but I attempted to...
Here is the given problem. I have a question for part c and e.
Calculate and print first 12 rows of the famous Pascal triangle, as shown below. Each number is the sum of the two numbers immediately above it. As our intent is to practice pointers, functions, loops, and dynamic memory...
Homework Statement
So basically I got this problem and I am still constructing an algorithm for it. I am not entirely sure the algorithm is going in the right direction, though. The problem is as follows:
The 2-D array and the pattern are read from two input files named Array and Pattern...
Hi.
I perform huge computations worth 70 lines. After those 70 lines, i have these equations in my internal memory.
%(stored internally) Wnet=(99*((57443*((4018*y*(66875/(57036*x))^(2528214091580831/18014398509481984))/5 - (57443*y)/50 + (2894969*x^(200/623))/50))/(50*((57443*y)/50 -...
#include <iostream>
using namespace std;
int a;
int main()
{
cin >> a;
int c [a];
for (int i = 1;i!=a+1;i++)
{
c [i] = i;
}
for (int i = 1;i!=a+1;i++)
{
cout << c [i] << endl;
}
return 0;
}
This compiles and does exactly what it's supposed to. But wait...
I have a an array of type complex. I am trying to assign a value to it in a loop, but I get a strange error "Unclassifiable statement at (1)". I really don't understand why.
do t = 1, count
real(in(t)) = cos(2 * pi * f0 * t)
aimag(in(t))=sin(2 * pi * f0 * t)
end do
thanks.
Homework Statement
I am not completely finished with the assignment, but I was trying to test to make sure that my functions "low" and "high" would in fact return the proper value (the lowest number in the array, and the highest number in the array, respectively). However, when I compile, I...
Hi every one. I had try to make a simple program but it doesn't work because i am an amateur
The program as following:
PROGRAM: Sum_row_n_col
!
! PURPOSE: Read the 2-rank array from input disk file and calculate sums of all of the data in each row and each column in the array.
...
So I suck at programming, but I need to find the determinant of a complex 6x6 array using GSL in C (not GSL complex, complex.h complex). Here is what has failed so far starting with a 6x6 double complex array named mymatrix:
gsl_matrix_complex_view m = gsl_matrix_complex_view_array(mymatrix, 6...
I have a question about calculating the pressure drop in a large flow meter across an array of nozzles. Basically its inside of a tunnel... air flows in this tunnel until it reaches a "gate" which is blocked off except for six nozzles of different size, which discharge back into an open...
I want to write a code for a MCU, the MCU will output an image to a TFT screen, and here is the tricky part:
I want to make the final display to mimic old CRT, which means it will shrink, skew, and out of sync randomly, and the image will be constantly shaking.
I hope the FPS would be 60...
Homework Statement
We have k >= 1 sorted arrays, each one containing n >= 1 elements (all equal length). We want to combine all of them into a single sorted array with kn elements.
We have a "naive" algorithm: merge the first two arrays, then merge the third array into the result, then merge...
Hello,
I am looking for some advice. I'm trying to perform array operations on vectors in MATHCAD. I am able to do it for vectors and matrices that have both dimensions that are 9 units or shorter. Anything that is 10 units or longer (ex, a vector with 10 elements) outputs a result such as...
So I am trying to use for loops to shift the index an array by a user inputted value. The code i have so far is
printMessage();
cin >> choice;
if(choice == 2){
cout << endl;
cout <<"Please enter...
I have a f(n*t) vs t data areay how to find out its (DFT) Fourier transform in c. I find every time that every program needs its real and imaginarry part. but i have only magnitude. please help me out to find DFT of these data .
I was given an assignment to create a program that solves the Josephus Problem ([URL="[PLAIN]http://en.wikipedia.org/wiki/Josephus_problem"].[/PLAIN] the program needs to work for n amount of people, and it must use an array.
Problem:
I need to create a subroutine that will allow the user...
I had to use an array to center and left align two different equations--a system of DEs.
However, by using array, the equations are smaller than I would like.
How can I increase the the equation size in the array.
$$\displaystyle\begin{array}{lcl}
\frac{dN_1}{dt} & = & r_1N_1\left(1 -...
I recently began making a cabinet into a grow station. It's almost finished, but I'm having trouble with the lighting system. In the beginning the idea was to make a full-spectrum LED light array of no particular voltage. I wanted to mimic this array I saw on LED Lights and Light Fixtures...
#include <stdio.h>
int main()
{
double sum, theta[100];
int i;
sum = 0.0;
i = 0;
while (i < 100)
{
sum = sum + theta[i];
i = i + 1;
}
printf("The sum of the array is %lf\n", sum);
}
when i run it i get a wrong answer...i don't know how to initialize the array
Homework Statement
suppose i have class A.
now i have 2 derative classes: A_1, A_2.
i would like to create a 4'th class: Array_Class.
Array_Class will have 2 pointers array (one for each class - A_1, A_2).
i want to be able to get an object pointer from class A_1 or A_2, and place it in...
Homework Statement
Hello,
I'm having a problem in multiplying two vectors together in a specific way in Fortran. I can do it in Matlab, but can't work out how to do it in Fortran.
The problem is that i want to multiply two vectors together, but only each element by it's corresponding...
Homework Statement
fname[i]='%05s - %05s . %05s - %05s' % (xstart,xend,ystart,yend)
gives the error
ValueError: setting an array element with a sequence.
Basically I wanted to turn the statement '%05s - %05s . %05s - %05s' % ('50','50','50','50') to a string/name
that goes into an array of...
Is is possible to design a more efficient thermopipe using a laminer flow heat source?
A. Test piece incorporates a length of 1.5 x 24 " black iron pipe to produce laminer flow.
B. A variable fan is used to input the air into one end of the pipe.
C. Fuel source is a 20 lb. propane bottle...
So I have a question about a circuit I'm making for class. I'm using this PowerSupply is a power supply I'm using in the lab. The 1kHz square wave is 700mV pk to pk with a 350mV offset. LEDarray is a red LED light array (http://www.ledtronics.com/Products/ProductsDetails.aspx?WP=2003).
When I...
if(gameBoardState[i][col] == 0)
{
gameBoardState[i][col] = playerTurn;
break;
}
This code is supposed to change the values in gameBoardState[i][col] (a 2D array), but it changes values in other elements too. For example, when col = 0, and i = 5...