Sunday, August 2, 2009

C++ how do I point to an element in an existing array?

How can I create a pointer that points to a specific item in an existing array (say item 5) and will let me then use that pointer like an array?





Here is my code:


http://www.marcovitanza.com/pointerArray...

C++ how do I point to an element in an existing array?
int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};


int *ptr;


ptr = array + 4;





Now ptr points to the 5th element in the array (remembering element 1 is offset 0)

online survey

C++ i need some body to help?

What is a constant pointer?


Declare an instance for it.





What about aa pointer constant?


Declare an instance for it.

C++ i need some body to help?
const int x;


int *constant_pointer = %26amp;x; // pointer to a const





const int* pointer_constant; // a pointer that remains constant
Reply:const char *p;


char const *p; p is const pointer


C programming: strcpy?

does strcpy make an actual copy of a string or just a pointer to the string that you are trying to copy? i'm writing a program where i pass a string into a method and the method uses strtok on the string i pass. however strtok modifies the string, which i don't want it to do. i guess i'm having trouble with my pointers and i thought strcpy might fix it but i'm still having the same problem. any suggestions on how to stop the method from modifying the string?

C programming: strcpy?
strcpy does make a deep copy of a c string. In fact, it copies the original string into the destination buffer, without much checking. For more on strcpy, look at http://www.cplusplus.com/reference/clibr...





As for processing your string you have 2 options. One is to make a copy of the original strign and use strtok on the modified string, like you attempted. Another alternative is to implement, from scrath, the parsing functionality you desire, without modifying the original string.





PS: For security reasons, depending on what this code is for, I would not use strcpy. strncpy and even memcpy are safer.


C++ help plz?

i want to write a function that get the size of an array by using pointers , where i should make a pointer points at begin of the array and another one points at the end of the array , then i have to return the size of the array at last .





int size(double *begin,double *end), any help?

C++ help plz?
The previous answer does well to explain the idea of computing the difference in bytes between two addresses, and dividing by sizeof(double) to get the number of elements. It's good to understand that, but pointer arithmetic can simplify it greatly. This also works:





int size(double *begin, double *end) {


return end - begin + 1;


}





Assuming end points to the last element of the array. The size of what begin and end point to is built into the calculation, you get it for free.
Reply:C++ stores arrays by allocating a single continuous block of memory. So if you allocate ten doubles, you allocate a block of memory:


10 doubles * (8 bytes / double) = 80 bytes





Now the pointer gives you back the location of the first byte, so how you compute the size depends on exactly what "end" means.





There are actually several possibilities:





1.) If end is the location of the last byte, then for four doubles:





begin -%26gt; xxxxxxxx xxxxxxx xxxxxxxx xxxxxxxx %26lt;- end





The answer is ((end+1) - begin) / 8.





2.) If end is the location of the last double in the array, then for four doubles:





begin -%26gt; xxxxxxxx xxxxxxxx xxxxxxxx end-%26gt; xxxxxxxx





The answer is ((end - begin) / 8) + 1.





3.) If end is the location of the first byte after the array, then for four doubles:





begin -%26gt; xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx end -%26gt; x





This is the easiest case. The answer is (end - begin) / 8.





Imagine allocating a single double starting at location zero. Then you allocate bytes at address zero, one, two, ..., seven.





So if we allocate n objects, each of size s, then we allocate n*s bytes. If the first allocated address is f, then we allocate the following locations.





first = f + 0


last = f + n*s - 1





Hope this helps!


C Programming: qsort?

OK... I have a pointer to an array of structures with various different properties... for instance a name and an integer.





How do I use qsort to sort by number?





What I'm doing now:





qsort(Structure[N]-%26gt;Number, N, sizeof(*N), SortFunction);





It says that arument 1 makes a pointer from an integer without a cast. How do I solve this problem?

C Programming: qsort?
the argument for qsort has to be the base structure. You can't reference an item inside the structure.





Your qsort call needs to be:





qsort((void*)structureArray, numberOfStructuresInArray,


sizeOf(Structure), SortFunction);





Your sort function needs to be:





int SortFunction (const void * a, const void * b)


{





return ((Structure*)a-%26gt;Number - (Structure*)b-%26gt;Number );


}





The sort function and qsort must deal with the entire structure, not a part of it. Does that make sense?





E-mail if not... jon at j-phi.com.
Reply:In my early days, I used to write progs for the Atari using various forms of Basic. Sorts - according to size - were either Q Sort or bubble.





I tried hard to get on with C++, but after basic, it was too much hard work.





No help with your problem - just added for interest.!

salary survey

C Program. Need help?

int addr;


typedef xdata unsigned char * memaddr;





*(memaddr)addr = value;





==%26gt; I am not clear about "*(memaddr)addr = value"


==%26gt; Is it a double pointer or sigle pointer?

C Program. Need help?
Cprogramming.com is a web site designed to help you learn the C or C++ programming languages, and provide you with C and C++ programming language resources. The Getting Started with the C++ language section gives advice about learning C or C++. Learn from our C and C++ language tutorials, or test your programming knowledge with our programming quizzes including the C++ MegaQuiz. If you need help getting set up, check out our compilers page. Don't forget to bookmark this site and check back for our frequent updates.
Reply:typedef is used for give the complex declaration to user desired. if you give


typedef int pint;


we can use pint instead of int.





in your statement


memaddr can be used instead of char *.


So, addr is pointer to pointer.
Reply:i think its a shortcut of pointer using 2 line statement.its a single pointer.coz double pointer means when a pointer is pointing another pointer.but in this case addr is , i think not another pointer just simply variable
Reply:This is a double point, but you will run into issues here.





What you really should be doing is this:





int addr;


addr = (int)value;


C programming free() function - does it really not need a size argument?

When you get heap memory with malloc, you have to use a size argument. To release the memory with free(), apparently you just use the pointer. Does this really release the memory from, say, a large structure pointer, and not just the first byte?

C programming free() function - does it really not need a size argument?
No, it doesn't need an argument. A good implementation will be able to recognize the block of memory being freed and the internal bookkeeping created during the malloc() will be used by free() to determine the size of the allocated block.





Yes, when you free a pointer, you're implicitly freeing ALL of the memory that you allocated when you malloc()'ed and received that pointer.





You should only be free()'ing pointers that were returned by malloc().
Reply:If you go into the implementation, when you call x = malloc(1000) you get a pointer to 1000 free bytes. Actually, the system allocates more than 1000 bytes. At the fromt of this, location x - (something), there is a memory structure that the OS uses for bookkeeping. When you free(x) the OS retrieves that structure, so it knows how much memory is allocated at x.

survey

About int <> char casting in c++?

I am attempting to create my own encryption algorithm. I basically would like the dycrpt/encrypt functions to accept a pointer and a byte amount and then modify that many bytes at the pointer. I understand what I want to do, but I am having problems working with the data. Is there any way to make a 1 byte integer? And would casting the pointer to that type, and then working with the data thru the new pointer work?





Also, for overflow, do I have to manually reset to 0 if it wud overflow, or can I rely on the fact that it will overflow as expected and not raise any exceptions?

About int %26lt;%26gt; char casting in c++?
The first answer is good. I just wanted to add that casting a pointer to a single byte and casting it back has potential for problems. Depending on the platform, a pointer is going to be 32 or 64 bits typically. Older systems used a segmented memory system that could use 16 bits. In either case, that data will not fit into a single byte. You should get compiler errors telling you about a potential loss of data.
Reply:1. char is already effectively a one byte integer. You may want to add "unsigned" to the front of it.





2. Not sure what the casting is buying you or what you are trying to do. If you want to access data through a pointer a byte at a time a char * (or unsigned char *) pointer is fine.





3. If Again, I'm not sure what it is that would overflow. If you want to make sure an integer doesn't overflow (and it's not meaningful to have values below 0), make it unsigned, it is guaranteed not to overflow, it will "roll back". For example the maximum unsigned int plus 2 would be equal to 1. In this example If you want it to be 0, not 1, then yes, you have to check for that yourself.


Theoretically should this algorithm work?C++ Algorithm?

Theoretically speaking if one wanted to swap the sub trees of a binary tree wouldnt it be as simple as telling the roots left pointer to point to the right pointer and the right pointer to point to the left pointer??





Or is there more to it?

Theoretically should this algorithm work?C++ Algorithm?
You'll want a temp var in there of course.





tempPtr = rightPtr


rightPrt = leftPtr


leftPtr = tempPtr


Is there a C++ expert around?? How do I write an iterator for my linked list class in C++??

so i want to write an iterator by writing a function/method like this





typedef Node%26lt;Type%26gt;* iterator





void operator++(Node%26lt;Type%26gt;* rhs){


rhs = rhs-%26gt;next;


};








but where would i put this?? and how would i template it?? would it be a member of the class, friend function, or do i have to make node a class??? also how would i do post increment??





i know post increment works like operator++(int)...but doesn't that have to be a class in order to call





list%26lt;int.%26gt; z;





list%26lt;int%26gt;::iterator x = z.begin();


++x;





here is my code.... thanks!





template %26lt;typename Type%26gt;


struct Node{





Node* next;


Node* previous;


Type data;





};





template %26lt;typename Type%26gt;


class list{





public:


//constructor


list();





//destructor


~list();





void push_back(Type);





void push_front(Type);





Type%26amp; get_front();





Type%26amp; get_back();





int size();








private:





// pointer to the front of the list


Node%26lt;Type%26gt;* front;





//pointer to the back of the list


Node%26lt;Type%26gt;* back;


};











template class list%26lt;int%26gt;;


template class list%26lt;double%26gt;;

Is there a C++ expert around?? How do I write an iterator for my linked list class in C++??
The iterator itself is a templated class.





template %26lt;class Type%26gt;


class Iterator {


...


}





The methods defined for the iterator are used to traverse any type that conforms to specific rules you define in the iterator. This can be linked nodes, a contigous array, or any other referencing method.





A good way to implement this is to create an abstract inherited class (e.g. Iterable), that contains the methods or attributes that the inheriting storage class must implement to provide iteration capabilities.





The iterator class itself will utilize the methods or attributes defined in the Iterable base class, ensuring that all instances of your iterator type will work with any storage type which implements the Iterable class definition.





e.g.





template %26lt;class Type%26gt;


class Iterator {


// Define iterator methods (e.g. operator++) which may


// use methods defined in 'class Iterable'


};





template %26lt;class Type%26gt;


class Iterable {


public:


...





// Resets iterator to begining of list


Type* begin(Iterator%26lt;Type%26gt;%26amp; itr) = 0;





// Resets iterator to end of list


Type* end(Iterator%26lt;Type%26gt;%26amp; itr) = 0;





// Returns the pointer to the first element in storage


// Used to determine iterator position through comparison


Type* begin() = 0;





// Returns the pointer to the last element in storage


// Used to determine iterator position through comparison


Type* end() = 0;





};








template %26lt;class Type%26gt;


class List : public Iterable%26lt;Type%26gt; {


...


};
Reply:u answered one off my c++ questions. i understand what you said some what. can you show me how i would apply that to this:


http://answers.yahoo.com/question/index;...





you can contact me through email if u like.


Do you know what the remote/pointer is called that gathers statistics in a class room setting?

I am about to do a presentation and I want to gather the students opinions in an easy way. While I was in school, one of my professors brought these remotes in and he would ask us a question and we would hit a, b, c, or d on the remote. The results would appear automatically on the computer screen in the form of a graph or other format. Where can I get one of these? and What is it called?

Do you know what the remote/pointer is called that gathers statistics in a class room setting?
I am using one of these remotes currently. The one I have is called a TurningPoint RF keypad. You can find it on this website:





http://www.turningtechnologies.com/inter...





I think this is what you're looking for, right?





EDIT: to your additional question: I am not sure how much to rent (or if you CAN even rent), but I had to buy one of these cards from my college bookstore for $40. I don't know if that gives you an idea of the cost.
Reply:I have one of these at school. We havent used it in a few years, and my head hurts trying to remember the name of it.





However, another quick easy and free way to be to amke a zoomerang survey which you can do here http://info.zoomerang.com/.





Register and make your survey. We use them all the time at school.

land survey

In C++, the difference between the following?

constant pointer to a character array.


pointer to a constant character array.


constant pointer to a constant character array.


Please explain with the correct notations.


Thanks.

In C++, the difference between the following?
constant pointer to a character array. : pointer always points to the array, but the contents of the array can change.





pointer to a constant character array.: pointer points to an array whose contents are fixed.





constant pointer to a constant character array.: none can be changed.
Reply:you can't change a constant pointer's value. it will always point to the same memory location.





char chrArray[] = { 'H', 'i', '!' };


int *const cPtr = %26amp;chrArray; // constant pointer to char array





const char chrArray[] = { 'H', 'i', '!' };


int *cPtr = %26amp;chrArray; // pointer to constant char array





const char chrArray[] = { 'H', 'i', '!' };


int *const cPtr = %26amp;chrArray; // constant pointer to constant char array
Reply:Character array is computer memory (stored at address1) where it is stored a set of characters which constitutes this array.





Pointer is again computer memory (stored at address2), which stores the value which is again an address (in this case address1).





Constant is modifier keyword which makes the specified computer memory is protected in a context.





Constant pointer to character array =%26gt; Pointer is protected but not the array pointed to by this pointer. So you cannot make this pointer to point to any other character array but you can change the pointing character array to store different characters.





pointer to a constant character array =%26gt; Pointer is not protected but the memory this points is. So you cannot modify the content of the character array but you can change pointer to point to any other location.





constant pointer to a constant character array =%26gt; In this case memory places are protected and you cannot change any of them.





Hope that helps.


What is reference operator and pointer operator?

what is reference operator in c

What is reference operator and pointer operator?
There is no reference operator in C, that's a C++ thing.





In C++, within the argument list of a function declaration or prototype, %26amp; is the reference operator, and * is the pointer operator. e.g.,





int foo(int *pointer, int %26amp;reference);





Note that in the example above, "pointer" and "reference" work almost identically, in that the called function can alter the contents of either argument, as seen by the calling function. The difference is that a pointer type must be passed by address, and dereferenced to obtain the value it points to. For reference types the compiler does that for you. e.g.,





// sets the value of first 2 args to 1


int foo(int *pointer, int %26amp;reference, int val)


{


// first arg is pointer, must use dereference operator


// to access contents


*pointer = 1;


reference = 1;


// we could assign this 10,000 times, but the


// caller will never see it, because it was passed


// by value.


val = 1;


}





int main(int argc, char **argv)


{


int i1 = 0, i2 = 0, i3 = 0;





// first arg is pointer, must use address-of operator


// to pass its address


foo(%26amp;i1, i2, i3);


// both i1 and i2 now contain the value 1


// but i3 is still 0


//...


}





(To confuse matters, %26amp; is also the address-of operator, and * is also the dereference operator, it depends on where they are used.)


In C I have a data structure that has a character array. How do I pass the array to another function?

If my array in the structure is: char word[20];


how do I pass this to this function?





pointer NewListNode(char n) {


pointer p;


p = (pointer) malloc(sizeof(list));


p-%26gt;word = n;


p-%26gt;ptr = NULL;


return p;


}





This is wrong...the compiler said "incompatible types in assignment" where it says "p-%26gt;word=n. What is the correct syntax?

In C I have a data structure that has a character array. How do I pass the array to another function?
Well, your variable "n" is a character (char), and not a character array. So, something more appropriate would be:





"p-%26gt;word[3] = n;"





This would make the 4th character in the array equal to whatever "n" is. If you want "n" to be an array, the function should be like:





"pointer NewListNode(char* n) {"





Where the "char*" means that "n" would be a pointer to the array of characters.
Reply:use inheritanceand make sure that the class is public


C++ questions?

from my book... just studying


two more... so im looking... since i now know the pointer it wants an array i believe...


code gets the best answer... explain it to me too








1. Write the statement, which dynamically creates a new array of integers. The number of elements for this array should be 'numbers'. The address of this new array should be assigned to pointer variable 'd_address'.


Assume that 'd_address' is already declared.














2. Rewrite the following in pointer notation. Use the simplest form, assuming that this call is not part of a loop; in other words, do not include a counter which would reach the zero element:


array[0] -

C++ questions?
1) use the "new" keyword to dynamically create arrays in C++ (they didn't have this in C). The pointer to this array of integers is assigned to d_address.


d_address = new int[numbers];





2) array[0] is the first element of the array, which is exactly where the pointer to this array is pointing. The equivalent form with pointers is


*array


(assuming the elements are 1 byte each, then array[1] would be *(array+1), array[2] is *(array+2), etc.)

survey software

C or C++ programing?

(a)


Writing a program that takes a decimal number input from the user and displays its binary number equivalent in 12 bits on the screen.





For example:


Enter a decimal number: 32


Its Binary Equivalent is : 000000100000





Hints


Conversion to base (2) is accomplished by successive divisions by 2. Make use of a loop for successive divisions.


Make use of %( modulus) and / (divide) operators (binary) to get the results.








(b)


Creating a program that declares an integer array with five elements. Now store in that integer array five different elements (10,20,30,40,50) using a pointer variable only.





Hints


The identifier of an array is equivalent to the address of its first element, as a pointer is equivalent to the address of the first element that it points to.





If A[5] is an array then the expressions A[2] and *(A+2) designate the same thing. Use (*A+2) to store the value in the third element of array.

C or C++ programing?
I'd do both in C, and do both by myself, rather than cheat on the assignment. The reason is that I would want to become a competent programmer who is really able to do things. Such programmers make good money, but companies aren't interested in paying people who can't do anything.
Reply:do your own homework
Reply:Tricky. I'm going with C++
Reply:you should first devid your number by ten (you can do it by a loop).and every digit you reached print it on the screen.





if you want the program i can write it for you.so mail me to send it for you as free.


This is a 10 pointer for the chemistry buffs out there ??????????

OK here's the deal i just started a hobby of refining e-scrap and i need to know some of the abbreviations for this such as peroxide, nitrous oxide , meturtatic acid , etc please give me any and all abbreviations that you think i would need to know and please no stupid answers I'm in desperate need also im looking for a book by c.m.hooks on refining e-scrap if any body knows where i can get one for very cheap

This is a 10 pointer for the chemistry buffs out there ??????????
Purchase Lange's Handbook Of Chemistry or The CRC Handbook Of Chemistry and Physics for names and molecular formulas. Peroxide means you have a compound where the oxygen is carrying a -1 charge instead of -2. ie., H2O2 is hydrogen peroxide. nitrous oxide is NO (N assigned oxidation of +2), your acid is organic but I don't recognize the name. You can also type in any name of any compound on google and it will give you the molecular formula and standard known data. I have no input regarding the text you referenced. Hope this helped a little. Good Luck.


Given the structure and pointer, what assignment statement sets the Price member of the structure pointed to?

by PC to 1000???????





struct Computer


{


char Manufacturer[30];


float Price;


int Memory;


} *PC;


int main (void)


{


struct Computer pc;


PC = %26amp;pc;





return 0;


}





a. PC-%26gt;Price=1000.0;


b. PC.Price=1000.0;


c. *PC.Price=1000.0;


d. Computer.Price=1000.0;

Given the structure and pointer, what assignment statement sets the Price member of the structure pointed to?
The answer is a).





PC is a pointer to a Computer.


To dereference a pointer, use -%26gt;.


Hence, the answer is PC-%26gt;Price = 1000.0;





You could also use (*PC).Price = 1000.0; however c) in the above example is wrong because it does not include brackets, which are required here.


What do these two pointer and address mean?

If I have these two C++ statement, can someone explain to me a plain english :





Tcl%26amp; tcl = Tcl::instance();





and





Tcl* tcl = Tcl::instance();





I know abit of programming. Just want to know what it actually mean and the differences.

What do these two pointer and address mean?
First of all let's get this straight, in this instance, the "%26amp;" is NOT the "address of" operator, it is used to declare that the variable is a "reference".





Now, as you've surmised, the two forms are similar, but there are a few key differences between using a pointer and a reference.





Tcl%26amp; tcl = Tcl::instance();





In this case, tcl is a reference to an instance of a Tcl object. To access members of tcl, you use the '.' operator (e.g. tcl.member). You treat tcl exactly as you would a local instance of a Tcl.





Tcl* tcl = Tcl::instance();





In this case, tcl is a pointer to an instance of a Tcl object. To access the members of tcl, you use the '-%26gt;' operator (e.g. tcl-%26gt;member).





Important differences:





With the pointer tcl, you can still point to something else





Tcl *p = Tcl::instance(); // p points to first instance


p = Tcl::instance(); // p now points to second instance, first intsance unchanged





With the reference it now looks like:





Tcl%26amp; p = Tcl::instance(); // p references first instance


p = Tcl::instance(); // p still references first instance


// but contents of first instance overwritten by second





There are a few other subtle differences, but I think the above hits the high points.
Reply:'%26amp;' refers to address of the variable name specified to the right of it.


'*' refers to the value at the address specfied by the variable to the right.
Reply:In your question Tcl is a class and tcl is an object.


Tcl %26amp;tcl=Tcl::instance() assign Tcl::instance() address into Tcl %26amp;tcl wlile Tcl *tcl=Tcl::instance() assign Tcl::instance() value into Tcl *tcl.

survey research

Given the structure and pointer declarations below, which sets the Price member of the structure?

pointed to by PC to 1000





struct Computer


{


char Manufacturer [30};


floatPrice;


int Memory;


} *PC;


int main (void)


{


struct Computer pc;


PC = %26amp;pc;





return 0;


}





a. PC-%26gt;Price=1000.0;


b. PC.Price=1000.0;


c. *PC.Price=1000.0;


d. Computer.Price= 1000.0

Given the structure and pointer declarations below, which sets the Price member of the structure?
May you need to contact a C expert. Check http://k.aplis.net/
Reply:Well, I actually wrote out a legitiate answer to this question, assuming that it was an honest issue. However, after looking a bit longer at the questions page and seeing that every other question on the list was you asking another homework problem, I suddenly lost interest in helping you. Good luck with it, pointers can be a bit tricky.


Assume pint is a pointer variable.For each of the following statements,determine if vald on invalid?

If invalid explain why?


a)pint++;


b)--pint;


c)pint /= 2;


d)pint *=4;


e)pint += x; // Assume x is an int.

Assume pint is a pointer variable.For each of the following statements,determine if vald on invalid?
Technically they are all valid - some simply don't make any sense





a - advance pointer


b - decrement pointer


c - divide pointer by 2; I can't think of a valid reason to do this


d - multiply pointer by 4; again I can't think of a reason one would do this


e - this could be reasonable - add some offset to the pointer; like go to the next part of an array


German Short Hair Pointer whines all the time?

We have a 9 month old GSP who whines constantly. We take him out constantly, for atleast an hour a day to play and run. So we know its not b/c he is bored, we are always trying to play with him. He is happy and up beat puppy. But when he wants something he just whines. If my husband and I hug he whines, if we aren't paying attention to him 24/7 he whines. Any thoughts on how to break this habit? Its becoming a huge hassel.

German Short Hair Pointer whines all the time?
Ignore EVERY minute of it. Don't look at your dog while he's doing it and go about your business. He will catch on quick enough. Dogs are very smart. He knows if he whines he will get your attention. You need to be consistent with ignoring his whines
Reply:His whining may be a sign of stress. Instead of ignoring it when happens, try preventing it. Basic obedience training helps keep his mind occupied and helps produce a well-mannered dog in the process. Working on commands for several minutes throughout the day keeps him on his toes (since he won't know when to expect you to work him). In addition, making him earn your attention (even walks and play time; even meals) so that he uses his energy for something useful. For example having him sit and wait for his food bowl is a way to make him 'earn' his food. See the attached link on NILIF (nothing in life is free) for more examples of how this works. Used consistently, it can change a dog's behavior in a matter of days.


Good luck.
Reply:Just ignore him and give him times of attention, and times of no attention at all.. IGNORE. He has to learn who is the boss and learn you are the one who decide when he does what. Your dog has control over you! He knows that when he whines, you take care of him.. my puppy has this tendancy as well.. when we don't play with him, he will whine, bark once at us, push us, make noise with his toys, leak my hands or feet... most of the time, after 5 minutes he get quiet if you ignore him. But if he doesn't get quiet, you should go out and play with him for a while, then go home and ignore him. One hour of walking is not so long for a 9 month old.. puppies are like teenager.. they are always full of energy.. mine is 5 month old and since we have him (what we read in the book, don't correspond at all to him.. ) we need to go minimum one hour walk per day (in the snow, near a lake, etc).. and this is labrador retriever.. he is heavier than normal for his age (but not fat at all!). So your dog needs more entertainment and has to learn who is the boss.


What is a pointer?

it is a computer oriended term.in c programming language to learn this term

What is a pointer?
Pointers are used in C and C++ -- its merely a variable that holds a memory address location.

survey for money

Trigonometry problem - pointer wanted?

In triangle ABE, A and B lie on a circle (centered at O), and E lies outside the circle. BE intersects the circle at C, AE intersects at D. (Thus, quadrilateral ABCD is inscribed in the circle.) AB:BC:CD:DA are in the ratios 10:7:7:12. What is the length of BE?





This is from ARCO's Preparation for the Praxis II Exam 2005, and I'm really interested in how to solve this more than the answer. (The question, #17 on p.155, actually gives AB's length as 8 and offers 4 nearest-integer answers: 50, 37, 31, 29.) Decades ago, I'd have aced this exam without prep, but I need to refresh what I need to know.





So "remember that ..." hints would be perfect for me. Thanks.

Trigonometry problem - pointer wanted?
It is fairly easy to prove that triangles EDC and EAB are similar, i.e. have all their angles equal. This might help because you can then use ratios of side lengths.
Reply:There is a theorem dealing with secants (BE and AE are both secants). BC * CE = AD * DE


A mouse pointer that resembles a hand with a pointing index finger means that you;?

a-are in the process of downloading a file from the internet


b- have previously visited that particle document on the web


c-can type text at that point


d-can click at that point to " jump" to a different web page?

A mouse pointer that resembles a hand with a pointing index finger means that you;?
d. When you scroll over a text or image and the hand image appears, it means that that particular text/image is a link to another page.
Reply:D. Is this a quiz? Or do you really want to know?
Reply:D i think


Related to pointer arithmatic in Java.?

Can u answer me what is the substitute code of Java for the following


C code-


first Fuction-


int fun(classobj self)


{


U16 **ppLen;





function(%26amp;p, %26amp;self-%26gt;ArrList);





ppLen = (U16 **)ListIterMoveFirst(%26amp;p);


if (!ppLen)


return 1;


(**ppLen)++; //Problem is here


return 0;


}





2nd Fuc-


U8 fun(calssnm self)


{


U8 rval = *self-%26gt;pCurrent; //pCurrent is a byte[]


self-%26gt;pCurrent++; //Problem is here


return rval;


}





3rd problem-


U16 function(classname self)


{


U16 rval = *((U16 *)self-%26gt;pCurrent);


self-%26gt;pCurrent+=sizeof(rval); //problem is here


return rval;


}





4rth-


int fun(P p1, P p2)//P is a class


{


return (int)p1 - (int)p2;//prob is here.


}





5th-


U16 **ppLen; //ppLen is object reference passing as Arg.


(**ppLen)++; //problem is here

Related to pointer arithmatic in Java.?
First of all i wanted to say you is there are no pointers in java.


So, there is no speech of pointer arithmetic here.





Problem 1: no pointers avl.





Problem 2: No pointers avl.





Problem 3: No sizeOf() operator avl in java because the size of data types is the same in java whatever be the platform you are working on. so, there is no need for a special operator to know its size when the size of fixed. Refer the dicumentation for the size.





Problem 4: You cannot typecast an object to a primitive data type. you can typecast an object of subclass type to superclass type.





Problem 5: no pointers avl.
Reply:There are no pointers in java so there is no perfect match of code. When you create classes or objects in java, the names of those classes are really pointers to the objects but this is handled behind the scenes. For a double pointer, this is like an array of java objects - or an object within an object, depending on your interpretation.





For the first problem, you can create ppLen as a return from another class. Ie.





ppLen = (U16 **)ListIterMoveFirst(%26amp;p);





might be





ppLen = ListIterClass.ListIterMoveFirst(p);





2nd problem is the same except instead of using a function inside the class you just return a member variable.





3rd problem is the same as 2nd problem because sizeof() exists in java as well.





4th problem you dont have to do anything because you can cast to (int) in java as well as C.





5th problem I'm a bit confused as to what it means but if you use the information in this answer and think about it you can figure it out on your own. Good luck!


A mouse pointer that resembles a hand with a pointing index finger means that you;?

a-are in the process of downloading a file from the internet


b- have previously visited that particle document on the web


c-can type text at that point


d-can click at that point to " jump" to a different web page?

A mouse pointer that resembles a hand with a pointing index finger means that you;?
D,,,, i need points pick me as best
Reply:are you looking with adobe reader by any chance it sounds like it to me.
Reply:D it means you are hovering over a link, a portal to another page.
Reply:d

survey questions

Using the pointer style, write a program that calculates the area of a rectangular garden. You must have:?

*Applicable to anyone who knows basic C++ 6.0


- A function requesting that a user enter the length of the sides of the garden


- A function to calculate the area of the garden, in square feet


- A function to determine the number of bags of bark chips needed to cover the garden(one bag will cover 9 square feet)


- A function to print the area and the number of bags of bark chips to the screen


THANKS!

Using the pointer style, write a program that calculates the area of a rectangular garden. You must have:?
Or in other words...





"Hi, I'm too goddamn lazy to even think about doing my own homework so I've copied and pasted the questions I've been set to Y!Answers in the hope that some fool will be stupid enough to do it for me. Perhaps if I actually applied myself one day I might get some satisfaction from achieving something myself, but I doubt it."


10 pointer, be the 1st to get this right- how many children are in my family??

A-4


B-8


C-6


D-12

10 pointer, be the 1st to get this right- how many children are in my family??
D
Reply:A=4 got points?
Reply:b
Reply:C
Reply:I would say 4 since you picked four letters.


Pointer/Array Question?

Given the following definition:





int num[26] = {23, 3, 5, 7, 4, -1, 6};


int* pn;





write a test to check whether pn points beyond the end of num.





Please help me answer this question taken from my C programming textbook.

Pointer/Array Question?
Pointer arithmetic is a complicated topic of C/C++.





Basically, in C %26amp; C++, an array is a pointer to the memory location of the first element. All other elements in the array are located in memory right after the first element.





Pointer arithmetic is based on addition and subtraction of pointer values. Also, memory is incremental. When you add an integer "n" to a pointer "p" the result "pr" is a pointer of the same type as the original pointer and its value is a pointer to the memory location where the n-th element of the array pointed by "p" should be.





From your question, if you apply what I said, you can test if pn is pointing beyon the end of array num like this:





if (pn %26gt; num + 25)


{


// pn is pointing beyond end of array num


}


Black screen with pointer before login, after BIOS boot - Vista?

sometimes, when i turn on the computer, i would get the normal BIOS boot screen, then the computer would just hang, with a mouse arrow and a black screen behind it,, without displaying the Windows logo or the login screen.





What has not worked:


AltCrtlDel


restarting





What has worked:


Starting in safe mode


+windows restore





Specifics:


OS Name Microsoft® Windows Vista™ Home Premium


Version 6.0.6000 Build 6000


Other OS Description Not Available


OS Manufacturer Microsoft Corporation


System Name HOME-PC


System Manufacturer Dell Inc.


System Model Dell DM061


System Type X86-based PC


Processor Intel(R) Core(TM)2 CPU 6400 @ 2.13GHz, 2128 Mhz, 2 Core(s), 2 Logical Processor(s)


BIOS Version/Date Dell Inc. 2.2.1, 3/23/2007


SMBIOS Version 2.3


Windows Directory C:\Windows


System Directory C:\Windows\system32


Boot Device \Device\HarddiskVolume3


Locale United States


Hardware Abstraction Layer Version = "6.0.6000.20500"

Black screen with pointer before login, after BIOS boot - Vista?
The most common cause of this is a problem with the disk drive. If it boots sometimes but not always (intermittent problem), the rest may still be OK. Check all cables and connectors. Since this is a dell, download and run the dell diagnostics for your PC, especially for the disk. If your PC is still under warranty and the disk diagnostics shows problems, insist that they ship you a new disk drive, or, even better, return the PC and let dell install everything on a new disk.





You can also run extended BIOS startup check (enable in BIOS) to see if any other problems exist.

surveys

Pointer/Array Question?

Given the following definition:





int num[26] = {23, 3, 5, 7, 4, -1, 6};


int* pn;





write a test to check whether pn points beyond the end of num.





Please help me answer this question taken from my C programming textbook.

Pointer/Array Question?
if (pn %26gt; %26amp;num[25])





of course this assumes that you initialize pn correctly


Pointer will not respond in enternet explorer yahoo intermitent?

c:/docume-1/carloo-/temp/wer9871.diroo/a...

Pointer will not respond in enternet explorer yahoo intermitent?
you can try to reboot everything and wait a while then try again
Reply:Try to reboot, it has worked for me in the past.
Reply:could be your computer has spyware problems? Run an anti-spyware cleaning program. Or ask again with more info.


Computer science help?

Which of the following statements about pointers is false?





a. Pointers are built on the standard type, address.





b. Pointers can be constants.





c. Pointers are machine addresses.





d. Pointers can be defined variables.





e. Pointers are derived data types.

Computer science help?
b
Reply:Here's an explanation of pointers, but I don't do homework:





http://xoax.net/comp/cpp/console/Lesson1...


C program for deleting those words starting with s n ending with letter d in a string without using pointers.?

Without using pointers is not really possible.


You can use the string as an index like this;


if (s[i] == ........


but actually s[i] is still a pointer.


Anyway you can avoid using * and %26amp; this way, if hats what you mean?


Then write your own string search functions.


the standard string search and compare functions are returning pointers.

survey monkey

Wap using pointers to calculate the sum of all elements of an array that are above 20 using c program?

int getSum(int *P)


{


int X;


int sum;





for (x=0;x%26lt;strlen(p);x++)


{


if (p[x] %26gt; 20)


{


sum = sum + p[x];


}


return sum;


}


}





For more free C/C++ source codes, visit: http://smartcoder.co.nr








KaBalweg


http://smartcoder.co.nr


Wap using pointers to calculate the sum of all elements of an array that are above 20 in c program?

main () {


printf("Write your own programs :)");


}


What kind of loop do u recommend I use for this ATM program in C?

Hi all, just a quick question for C programmers. I have to write a program that prompts a user to enter how much money they wish to withdraw in multiples of 10's. Then it returns the requested amount in 10's, 20's or 50's. But I have to write it by using output parameters or pointers. Obviously I'm gonna have to use a loop here. What kind of loop do you recommend and how many? I wouldn't use a "for" loop because those are only for when you have a pre-defined number correct? Thanks.

What kind of loop do u recommend I use for this ATM program in C?
Not quite sure why you need to use a loop here, unless you are talking about looping until the user is done entering data like





while(moreUserInput())


{


do_something_with_user_input();


}





To figure out what denominations to give out you can use the mod operation which will give you the remainer of what you divide by so





num50s = amt / 50;


amt = amt % 50;


num20s = amt / 20;


amt = amt % 20;


num10s = amt / 10;





amt = amt % 10; // This should be zero if your entry program is working correctly
Reply:Just use the modulus operator -- no loops


I want to solve minimal spanning tree/branch and bound algorithm problem using MPI /Cor C++, any code ?

I want to solve minimal spanning tree/branch and bound algorithm problem using MPI /C or C++, i did find some answers in google but aint working, did anyone take parallel computing course , can someone give me pointers to it ?

I want to solve minimal spanning tree/branch and bound algorithm problem using MPI /Cor C++, any code ?
You may find this tool useful in solving your problem.


http://osl.iu.edu/research/pbgl/

online survey

Has anyone ever worked as a makeup artist for M.A.C? If so, what is the initial interview like?

I want to work for M.A.C. I do really good makeup and I think I might have a shot. I just need to know what they look for, and if possible some pointers from someone who works or has worked there on how to get in.

Has anyone ever worked as a makeup artist for M.A.C? If so, what is the initial interview like?
intense, they are really picky about who they want working for them. make sure your appearance is 100% perfect from head to toe, including your makeup. your face is going to be an example that they will be looking at so make sure you give it your best. be confident, but not too arrogant, show them that you are capable without sounding snotty


Write a c++ program to read an inteegers and display that inteeger without using arrays & pointers ?

To display a single integer





#include%26lt;iostream.h%26gt;


#include%26lt;conio.h%26gt;


#include%26lt;stdio.h%26gt;


void main


{


int num;


cout%26lt;%26lt;"Enter a integer ";


cin%26gt;%26gt;num;


cout%26lt;%26lt;"\n The integer entered is "%26lt;%26lt;num;


}








To display multiple integers





#include%26lt;iostream.h%26gt;


#include%26lt;conio.h%26gt;


#include%26lt;stdio.h%26gt;


void main


{


int num,i,count;


cout%26lt;%26lt;"Enter the number of integers you want displayed ";


cin%26gt;%26gt;count


for (i=1;i%26lt;=count;i++)


{


cout%26lt;%26lt;"Enter a integer ";


cin%26gt;%26gt;num;


cout%26lt;%26lt;"\n The integer entered is "%26lt;%26lt;num;


}


}


What general methods should I use when creating this C++ console application.?

I'm creating a small banking application using C++ that will allow me open up an account, set an over draft limit for a new customer, display/update customer information and show balance by using an account number. Also like to deposit, withdraw.





I'm not looking for code etc, just some pointers. Can someone give me advice on where to start, or how to lay it out. I've done some Java before, but this is something else....





Any help would be greatly appreciated.

What general methods should I use when creating this C++ console application.?
Do it much like Java, except:





include any referenced header files before main, like:


#include %26lt;conio.h%26gt;


otherwise you get errors like "someFunction not defined"





free all allocations manually


otherwise you will get memory leaks





you can use getc or scanf (or others) for input





you can use printf for output, but C++ programmers often use cout like:


cout%26lt;%26lt;"Balance is $"%26lt;%26lt;balance





Hope this helps.
Reply:The most basic things you need to know are input/ouput, reading and writing files, and user-defined functions. After you can make a basic application using those you can try to use classes and templates. If you need more help just e-mail me.
Reply:I'm assuming this is just an academic exercise, or you have a ton more to think about to make this integrate with real banking.





The first thing to figure out is how you are going to represent the account and its data (including balance, overdraft limits, customer data, etc). You probably want to define a class to store the account data, with functions to access and modify the data -- get balances, modify balance, analyze overdraft rules, etc. The account rule logic can all be encapsulated in this class.





Once you've defined a class to represent the AccountInfo, think about how you'll represent the collection of accounts so you can easiliy find the account when the user requests an action on it. An STL map may be a good bet for storing your accounts for easy lookup. The key could be the account number, and the value could be your AccountInfo class.





You might also think about how you will create a new account and verify that the data entered is valid. Maybe you want an AcctManager class to do that. It will need to create a new account number and make sure it doesn't already exist in the account collection, make sure all required account data is present and valid, create the AccountInfo class and save the to the account collection. Maybe AcctManager owns the AccountInfo collection.





Do these accounts need to persist when the application stops? I'm guessing not.





Good luck!


(POLL) Presents for my man..HELP ME, CHOOSE A, B or C?

pointers: he likes sharks,frogs and other exotic animals. He also like dragons. He recently broke his phone which he used mostly because of the camera in it.





(A) digital camera for birthday (october) , books with facts about exotic animals for anniversary (november), shirt with dragon for xmas (dec)





(B)digital camera (october), wristwatch (november), books about exotic animals (december)





(C) digital camera (october), wristwatch (december), shirt with dragon (november)





JUST USE A. B or C and add a comment if you want


thanks

(POLL) Presents for my man..HELP ME, CHOOSE A, B or C?
I think the "B" is really good!!!!!.





Bye!.





JULIA.





=)
Reply:I think C
Reply:C - consider getting a gift card to a bookstore, instead of choosing the books for him.
Reply:A
Reply:A, B and C... for sure he will be happy...
Reply:B) Because he needs a camera and likes exotic animals.
Reply:B
Reply:I think A...

salary survey

When are pointers pass by value and when are they pass by reference in a c++ function?

Passing by value and passing by reference are the same for pointers as for ordinary variables.





When passing a pointer by value, you're actually passing the address that the pointer points to.





When passing a pointer by reference, you're passing the address of the pointer, which itself is the address of some other item.





Passing by reference allows you to change the location that the pointer points to whereas by value just lets you use that address - it'll have no effect on the pointer when the function returns.

When are pointers pass by value and when are they pass by reference in a c++ function?
Pass by value when you want to retain the original value regardless of changes to the value inside the function.


Pass by reference when you require the original value to be changed.


(POLL) Presents for my man..HELP ME, CHOOSE A, B or C?

pointers: he likes sharks,frogs and other exotic animals. He also like dragons. He recently broke his phone which he used mostly because of the camera in it.





(A) digital camera for birthday (october) , books with facts about exotic animals for anniversary (november), shirt with dragon for xmas (dec)





(B)digital camera (october), wristwatch (november), books about exotic animals (december)





(C) digital camera (october), wristwatch (december), shirt with dragon (november)





JUST USE A. B or C and add a comment if you want


thanks

(POLL) Presents for my man..HELP ME, CHOOSE A, B or C?
A....and I sure hope he is worth all this ,,I assume he is...Good luck
Reply:C is a good choice. My birthday is in November and I like Wolves..............Hint, hint......LOL
Reply:A and i wish i had a girl like you lol
Reply:A
Reply:get him a vibrating thing a-ma-jig at sharper image
Reply:I like B
Reply:c
Reply:i would chose b... but I'm a bit confused u want to get 3 gifts. the digital camera ids really nice because the pictures will create many memories.


the wrist watch is nice too, its always nice to know the time and it helps to be punctual.


i would chose a book over a shirt because i believe the book will get more use and be around longer
Reply:C


Where can i find an online free massachusetts P&C practice insurance exam?

Im looking to take a practice exam for massachusetts Personal lines %26amp; P%26amp;C can someone please tell me where to find one? Or if you have taken these exams any pointers?

Where can i find an online free massachusetts P%26amp;C practice insurance exam?
please search www.google.com


Can someone help debug this part of my C Basic program?

//Alphabetization of Multi-Dim string//


void bubblesort(char *R[], int a); //function declaration//





char *restname[20][30]; //Variable in main//





bubblesort(restname[30], 20);//Function bubblesort in main//





void bubblesort(char *R[], int a)//function bubble sort//


{ int i, j; char *hold;


for(i= 0; i %26lt; a; i++)


{ for(j=0; j%26lt;a-1; j++)


{ if(R[j] %26lt; R[j+1])


{ hold = R[j];


R[j] = R[j+1];


R[j+1] = hold;}


}


}


for(i=0; i%26lt;a; i++)


{ printf("%s", R[i]);


printf("\n"); }


} //end function//





This is for my CSE 1320 programming class


I cant figure out how to get the NEW restname multi-dimensional string to print in alphabetical order! I also cannot use any C,Basic built-in sort functions for this project AND i HAVE to use the sort function using pointers


Can somebody PLEASE help me?


If more info is needed, let me know... but i cant post the program in its entirity due to its length exceeding this text box's character limit


Thanks

Can someone help debug this part of my C Basic program?
I get the point. Your program is in descending order. So, you wish to arrange the characters alphabetically in descending order. The program will give you a syntax error because you cannot have a pointer that can also act as an array. Within the arguments of the bubblesort, there is a declared variable "*R[]" of character type. You can have "*R" or "R[]" but not "*R[]".





Bubble sort deals its elements individually, so I think it's better to use "%c" than "%s"





The main part that confuses me much is that you declared a 2-dimensional array to be passed in the arguments of bubblesort but in the bubble sort arguments you placed a 1-dimensional array and its size. If that is what is passed to the arguments then the entire program is logically erroneous because it only applies to a one-dimensional array.

surveys