To free up the memory would I do it like this?
double*dPtr = new double[numEntries];
delete [] dPtr;
And this is what is supposed to be done.
Type: Posts; User: BB89
To free up the memory would I do it like this?
double*dPtr = new double[numEntries];
delete [] dPtr;
And this is what is supposed to be done.
I am trying to print out the array elements while using pointers.
My Code:
#include <iostream>
using namespace std;
int main()
{
It works but am I supposed to have two
cout << "Enter a number: " << endl;
cin >> find_min; and
cout << "Enter a number: " << endl;
cin >> num;
#include <iostream>
I think I might be on the right track.
#include <iostream>
using namespace std;
int min(int find);
int main()
I need some help using functions. I wrote this code as if it was a regular program.
#include <iostream>
using namespace std;
int main()
{
Ok, I got it now.
Thanks to everyone that helped me.
Ahh, I have one last question.
When I input A as 0 it prints out "The result is: 0" as it should. But when I input B as 0 it stops. Should it print out "The result is: 0"?
I think I am on the right track now.
Now my code
#include <iostream>
using namespace std;
Yes, I can use a while loop.
I did say that I couldn't use a 'for loop'.
I going to work on it, in our class we have to write algorithms before we can even think about code. I am in my first programming class.
I cannot use a 'for loop' but I can use a 'do while loop'.
Write a program which will ask for two integer numbers (a and b). The program will multiply these two numbers, a and b, using repeated addition (CANNOT use multiplication operation) and print out the...
Ok, understood. Im gonna work on it.
Ok, one last question. What do you mean when you said
You are trying to print out a 2D array, as if it were a 1D array.
Do I need the second for loop?
can I do just one loop
if i changed the array to array[4][4]
for( i = 0; i < 4; i++ )
I am new to 2D arrays.
I am trying to print out the array.
#include <stdio.h>
int main (void)
{
I figured it out.
Thanks for the help.
I understand that, I do not want you or anyone else to give me the answer.
I don't inderstand
found_5 = 1;
Why do I need it?
Bithub: Where does 78 work in on your code?
I have it saying "5 is in A". What can I add to my code to make it find whether or not 78 is in A?
I am trying see if 5 and 78 are is my array.
So if x = 5 then "5 in is A" and if x = 78 then "78 is not in A".
What I have so far:
#include <stdio.h>
Ahh, makes since.
So
printf("A \ B = {%d}", A[x] );
#include <stdio.h>
int main (void)
{
int A[3] = {1, 2, 5};
int B[4] = {1, 5, 9, 10};
int x, z;
for( int x = 0; x < 3; x++ )
I am trying to find the numbers in the two arrays that are in common.
Say they are:
int A[3] = {1, 2, 5};
int B[4] = {1, 5, 9, 10};
Answer should say A \ B = {1, 5}
Good question, i am not to sure. I know I need a loop but I how to incorporate A and B.
slingerland3g: Yes, I am trying to find what is common in both arrays in this case it is {1, 5}. I not...
I am very new to arrays and programming in general.
Question: Finding the intersection
#include <stdio.h>
int main (void)
{