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

Friday, July 31, 2009

How to use new operater in a C++ class?

Does anyone know how to use and implement the new operator in a class? I have a test on this in 8 hours and I barely understand classes. I understand pointers a little better. Can someone give me a quick simple demo? Basically my test is going to give me a class and I will have to insert a new operator line to get it to work, it will most likely deal with arrays. I need to pass this test to pass the class, I'm desperate. I use visual C++ 2008, just anything that can compile.

How to use new operater in a C++ class?
The 'new' operator is utilized when you want to declare a dynamic variable. This variable does not have a name; it can only be accessed through the pointer that you declared it with. For example, in your 'main' function you might write:





int *p, *q; // Declare p and q are each int pointers.


p = new int; // Declare that p points to an unnamed variable of type int.


q = new int[10]; // Declare that q points to an unnamed array of 10 variables of type int.





Before the dynamic variable goes out of scope, you need to write:


delete p; // Free the memory for the unnamed int pointed to by p.


delete [ ] q; // Free the memory for the unnamed int array pointed to by q.











Suppose you have already declared and defined a Distance class. In your 'main' function you might write:





Distance *d1, *d2; // Declare d1 and d2 are each Distance pointers.


d1 = new Distance; // Declare that d1 points to an unnamed object of type Distance.


d2 = new Distance[10]; // Declare that d2 points to an unnamed array of 10 objects of type Distance.





Suppose that 'getDistance()' is one of the public member functions that you declared in your definition of the Distance class. To CALL that function (from your 'main' function) for each successive Distance object in the array, you might write:


for (int i=0; i%26lt;10; i++)


d2[i].getDistance();





Before the dynamic variable goes out of scope, you need to write:


delete d1; // Free the memory for the unnamed Distance object pointed to by d1.


delete [ ] d2; // Free the memory for the unnamed Distance array pointed to by d2.








A separate issue: You can declare dynamic variables inside a class. Suppose your Distance class has only pointers as private data members:


class Distance


{


private:


int *ft; // pointer to int


float *in; // pointer to float


public:


Distance(); // constructor


// Declare your other class member functions here:


};





// Define your class constructor:


Distance::Distance()


{ feet = new int; // Declare an unnamed int pointed to by the pointer 'feet'.


*feet = 0; // Initialize variable pointed to by 'feet' to value of zero.


inches = new float; // Declare an unnamed float pointed to by the pointer 'inches'.


*inch = 0.0; // Initialize variable pointed to by 'inches' to value of zero.


}





Or instead, you could declare a Distance class that has a constructor in which the pointers declare an array of 5 ints pointed to by 'feet' and an array of 5 floats pointed to by 'inches'. In that case you would initialize each of the array members using a for loop.





Distance::Distance()


{


feet = new int[5];


inches = new float[5];


for (int i=0; i%26lt;5; i++)


{ feet[i] = 0; inches[i] = 0.0; }


}


What is the point of having a private class for C++? What is also the point in having a public class?

what is the point of having a private class for C++? What is also the point in having a public class? Why do people use a public and private class, also aren't pointers involved somewhere in there?


How can i make a c program function that can delete an allocated structure?

if i will be having a program that has a allocated structure with pointers, how can i make a delete function????





example if the program asked for the address of a person and you would like to delete that particular address...hhow can i make that c program function????????

How can i make a c program function that can delete an allocated structure?
If you used malloc() to create the allocated memory, use free() in the reverse order to free up the memory.


Calculating letter grade using function in c++?

I am supposed calculate the letter grade using fuction in c++ and I just need some help with writing the actual function. so far, I got this





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





char getLetterGrade (int gradeIn) {


// replace this comment with your code for this function


} // letterGrade





// insert your code for the getNumericGrade function here








int main() {


int grade;


char letterGrade;





do {


grade = getNumericGrade();


if (grade != -1) {


letterGrade = getLetterGrade(grade);


cout %26lt;%26lt; "The student's letter grade is: " %26lt;%26lt; letterGrade %26lt;%26lt; endl;


}


} while (grade != -1);





cout %26lt;%26lt; "Good-bye" %26lt;%26lt; endl;


return 0;


} // main





can anyone give me any pointers of how to write this function?





Thank you

Calculating letter grade using function in c++?
I hope this isn't your homework, otherwise this is cheating.





Create IF, ELSE IF conditional statements in your function that retun the letter grade





example:


if gradeIn %26gt;= 90 %26amp;%26amp; gradeIn %26lt;=100


return 'A'


else if gradeIn %26gt;= 80 %26amp;%26amp; gradeIn %26lt;90


return 'B'


...


...


else


return 'F'





hope that helps

survey monkey

Calculating letter grade using function in c++?

I am supposed calculate the letter grade using fuction in c++ and I just need some help with writing the actual function. so far, I got this





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





char getLetterGrade (int gradeIn) {


// replace this comment with your code for this function


} // letterGrade





// insert your code for the getNumericGrade function here








int main() {


int grade;


char letterGrade;





do {


grade = getNumericGrade();


if (grade != -1) {


letterGrade = getLetterGrade(grade);


cout %26lt;%26lt; "The student's letter grade is: " %26lt;%26lt; letterGrade %26lt;%26lt; endl;


}


} while (grade != -1);





cout %26lt;%26lt; "Good-bye" %26lt;%26lt; endl;


return 0;


} // main





can anyone give me any pointers of how to write this function?





Thank you

Calculating letter grade using function in c++?
if grade%26gt;0 and grade%26lt;60 return f





if grade%26gt;59 and grade%26lt;70 return d





etc.


How do I copy an Audio C.D. into MP3 format?

I am trying to upload some original music onto my web-site but they are saying (support providers)that I need to copy the C.D. into MP3 format. I have been trying to figure out how to do this and I'm getting really frustrated. Can anyone give me some pointers?

How do I copy an Audio C.D. into MP3 format?
You can use Windows media player to do it, but i recommend using db Poweramp (http://www.dbpoweramp.com).





This allows you to rip CDs in mp3 or wave formats. Mp3 is a lossy format, and the loss in quality of the ripped files depends on the bit rate you select to rip the audio at. 128k is the minimum rate i would use for decent quality - as you increase the bit rate you also increase the file size as well as the quality.
Reply:Go to http://www.download.com/ and search for windows media player 10, download it and then go to TOOLS and Options or properties then to rip tab then put instead of windows media format mp3, then put your cd and rip it in the folder you choose.
Reply:Pretty simple. Windows Media PLayer and iTunes both allow you to rip to MP3. Make sure that your setting/options are set accordingly because WMP defaults to WMA and iTunes to MP4.
Reply:try any rip to mp3 software. there are lots of them on the net.
Reply:You can use Windows Media player, Real player, or another media player to rip the CD. make sure you set the option to convert to mp3 (128kbps since you're uploading the music), and to make a note of the folder that the songs are ripped to.
Reply:hey put in ur audio cd


open windows media player


either there will be an option below the top bar "Rip"


or u can go in it thru tool--%26gt;option--%26gt;Rip


rip ur audio cd into ur hard disk


u will get the required thing
Reply:You can do this by using one software called CDEX. U can download this software for free and after installing this there will be easy way in this software by, just put the cd in the CD Drive and just click the button CD to MP3 button. It will automatically convet the cd tracks to MP3 format
Reply:You can convert a audio cd into a MP3 using Windows Media Player. It's really easy.
Reply:you have to download a program that converts files to mp3 format and can brun them that way as well. I suggest trying http://www.download.com/3120-20_4-0.html...


Help with array in c++?

Hey im doing this program and i really need some help.





The program is to store alphabet as characters in an array


it must also:


Print the alphabet


Print the first 6 characters


the last ten characters


and the tenth character





Here is what i done so far








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





int main()


{





char alpha[27]={'a','b','c','d','e',


'f','g','h','i','j','k','l','m',


'n','o','p','q','r','s','t','u','v',


'w','x','y','z','\0'};





cout %26lt;%26lt; "The alaphabet is\n"%26lt;%26lt; alpha %26lt;%26lt;endl;








return 0;


}





The code above only prints the alphabet i think i should use something call pointers or summin to output the other characters but i don't know how

Help with array in c++?
You've done a good job so far, now it's just a matter of calling the right characters to print.





You will want to do a print statement something along these lines:





Print the first 6 characters:


int k;


for (k =0; k %26lt; 6; k++)


{


cout %26lt;%26lt; "The first 6 characters are\n"%26lt;%26lt; alpha[k]%26lt;%26lt;endl;


}








Print the last 10 characters:


int j;


for (k=27; k%26gt;=18; k --)


{


cout %26lt;%26lt; "The last 10 characters are\n" %26lt;%26lt; alpha [k]%26lt;%26lt;endl;


}





Print the 10th character:


cout %26lt;%26lt; "The 10th character is: " %26lt;%26lt; alpha[9]%26lt;%26lt;endl;








You might need to change the syntax up a little bit but this should give you general information and help about how to set up these simple print statements.





I hope this helps


Best Wishes
Reply:You need to loop through every value in the array.





cout %26lt;%26lt; "The alphabet is\n";





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


{


cout %26lt;%26lt; alpha[i] %26lt;%26lt; endl;


}
Reply:You don't need pointers for this particular exercise.


//first 6


for(int i=0;i%26lt;6;i++)


cout %26lt;%26lt; "Letter " %26lt;%26lt; (i+1) %26lt;%26lt; " is " %26lt;%26lt; alpha[i] %26lt;%26lt; endl;


//last 10


for(int i=15;i%26lt;26;i++)


cout %26lt;%26lt; "Letter " %26lt;%26lt; (i+1) %26lt;%26lt; " is " %26lt;%26lt; alpha[i] %26lt;%26lt; endl;


//10th


cout %26lt;%26lt; "The 10th Letter is " %26lt;%26lt; alpha[9] %26lt;%26lt; endl;
Reply:why dont you use for loop?


If you wanna print t, u,w,x,y,z then a for loop that counts 6 elements from the index of element you want to print, and then just print inside the for loop.


something like this:


for(counter = 22;counter%26lt;28;counter++)


{


cout%26lt;%26lt;alpha[counter] + "\n";


}


this prints from the index 22 to 28 in different lines. and you know how to change it so it prints in oneline.


hope it helped and good luck


Create dynamic array in C++ class?

I am reading a output file with approximately 50 int variables in it. The numbers are stored usingmy current declaration:





in List.h


int data[MAX_LENGTH];





in List.cpp


data[index]=item





I want to be able to dynamically create the array data (using new int[] and pointers, to satisfy an assignment), but still be able to use it as if it were statically created. I would also like to know how I can make the length of data be the length of the input file plus one. In other words, how can I make the array grow/shrink to match the size of it's information? Be nice, I'm only in my 2nd year of C++

Create dynamic array in C++ class?
Let's get the harsh part out of the way first: what you are doing is C, not C++.





The C++ implementation would be to use std::vector%26lt;%26gt;. That class will do what you are asking: it can be treated like a static array (it does offer range checking though!!) but can be resized and is allocated on the heap so size of your data does not matter.


Basic usage is like this:


#include %26lt;vector%26gt;


std::vector%26lt;int%26gt; myVector;


myVector.push_back(1); // let's put in some data..


myVector.push_back(5);


myVector.push_back(10);


cout %26lt;%26lt; myVector[0]; // let's access the contents


cout %26lt;%26lt; myVector[1]; // let's access the contents


cout %26lt;%26lt; myVector[2]; // let's access the contents





Look at the reserve and resize methods of vector to see how you can dynamically change the size of this structure.





If you really have to use new[] then you can simply create it like this:


int* data= NULL;


data= new int[someSize];


//add and retrieve the data


data[0]= 5;


cout%26lt;%26lt; data[0];


// and then get rid of it later with


delete[] data; data=NULL;





You can't really do dynamic resizing of a new'ed array. Instead you would have to create another array of a different size (smaller or larger) and slowly copy everything over from the previous array. Internally this is what std::vector does for you- which is why using reserve() is a good idea to reduce the number of copies.


Hope that helps.





ETA:


You can not call new[] as part of the declaration in your header file, it has to be in your source file:


mylist.h:


char* someList;


mylist.cpp:


someList= new int[500];
Reply:int main (void) {





float d, s1, s2;





int *my_array;





my_array = new int[50]; //or maybe 'new int[MAX_LENGTH]





my_array[33] = 304;





printf("33rd position contains %d",my_array[33]);





return 0;


}

online survey

How can I loose the belly from haveing a C-sections?

I had a c-section with my baby and it has been so hard to loose it! Any pointers on what to do!!!!

How can I loose the belly from haveing a C-sections?
Go for hoodia gordonii, its south afrian diet plant pill for loose weight from face, belly, thights, hips, and its also reduces appetite and decrease weight and also burn calories, fats. i saw the drama and advertise of hoodia on BBCand CNN. http://www.gordoniihoodia.net/hoodia-die...


and yes even you can lose weight by hoodia, am too much sure bcoz ma mom is one of them who loose almot 80 pounds in 3 months, i know that a big time duration but finally she loose fats from belly, thights, hips http://herbalzilla.com/?getlook and also her extra fats and calories has beeeen burn that makes her more sexy figured, she was using Hoodia Gordonii for 3 months http://h-oodia.com/?getlook


Help writing a C program dealing with rectangles?

Hello,


I need help writing a C program that takes the width of a rectangular yard and the length and width of a rectangular house situated in the yard. I don't want the answer because every programmer has a different way of writing code. I just needs some tips or pointers. Thank you in advance for your input.


-AB

Help writing a C program dealing with rectangles?
See Help for Rectangle() via Windows or _rectangle() for DOS window. Latter will also need _setvideomode() and maybe _setcolor() - see also _moveto() and _lineto()


In need of C++ programming help please!!?

I have been taking a programming course for a few weeks now and need a little help with an assignment. My assignment is to write a program that displays a menu with the the option to find the largest # with a known quantity of numbers; find the smallest # with an unknown quantity of numbers or quit.





Here is what I have so far, but my book has gotten me so confused. I need some pointers as to what I am missing or what is wrong and needs fixed. Any help would be greatly appreciated.


Serious answers only please.





#include %26lt;iostream%26gt;


using namespace std;


const int SENTINEL = -99; //to end option 'B'


int number; //variable to store numbers


int counter;


char limit; //variable to store amount of numbers to input in 'A'





int main()


{


char sel;


number = 0;


int count = 0;





cout %26lt;%26lt; "A) Find the largest # in a list." %26lt;%26lt; endl;


cout %26lt;%26lt; "B) Find the smallest # in a list." %26lt;%26lt; endl;


cout %26lt;%26lt; "C) Quit." %26lt;%26lt; endl;


cout %26lt;%26lt; "What do you want to do?" %26lt;%26lt; endl;


cin %26gt;%26gt; sel;


switch (sel)

In need of C++ programming help please!!?
You would be better off going to www.homework.com or to www.studybuddy.com There is a lot of help there.
Reply:You're overwriting the previously entered number every time you cin a number from the list.





You need to set up an array, say


int list[100];





Then use an integer variable to count your position in the array


int i;


cout %26lt;%26lt; "Enter the numbers for the list: "


while(i=0;i %26lt; listsize;i++)


cin %26gt;%26gt; list[i];





The better way to do this is to use a linked list since there is then no upper bound on the size of the list of numbers, but that is probably a bit too high level for an early programming class. I'd stick with the array solution.
Reply:well, first, your program will only run through 1 selection then end. you need to make a loop with your selections in it. something like:


do


{


//your selections


//your code


}


while (sel != 'c' || sel != 'C');





next, in your "case 'A'" you never initialize counter or increment it. did you mean to use count instead?





in your "case 'B'" you never increment count, and all it does is read in numbers. I assume you just didnt finish it yet because your still trying to get case a to work first.





thats for starters just off the top of my head
Reply:#include %26lt;iostream%26gt;


#include %26lt;cstdlib%26gt;


using namespace std;


int main(){


int i,min_val,max_val;


int list[10];


for(i=0;i%26lt;10;i++) list[i]=rand();


min_val=list[0];


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


if(min_val%26gt;list[i]) min_val=list[i]


cout%26lt;%26lt;"minimun value: "%26lt;%26lt;min_val%26lt;%26lt;"\n";


max_val=list[0];


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


if(max_val%26lt;lsit[i])


max_val=list[i];


cout%26lt;%26lt;maximum value: "%26lt;%26lt;max_val%26lt;%26lt;"\n";


return 0;


}


Computer Science C++ HELP!!!?

Does anyone know a really good website to learn about Computer Science C++? The book i have explains it in way too many details. I need something simple and understandable. I want to know about Pointers, Enums, Classes and Data Abstraction.

Computer Science C++ HELP!!!?
The C++ Language Tutorial! See the link below
Reply:Learn C++ in 21 Days!





http://newdata.box.sk/bx/c/
Reply:Go to www.programmersheaven.com Also check out your local community college for classes or join an online computer club or a local one.
Reply:Also check out http://www.cprogramming.com/tutorial.htm... for tutorials. Avoid the learn C++ in 21 days link posted above. The C++ tutorials there are outdated, and haven't been updated.

salary survey

The best way to learn c++?

Ive tried several times to teach myself c++ and I start out strong but get frustrated when dealing with more complex topics especially pointers, working with data, classes, and other stuff. I feel like I need someone who knows what theyre doing to talk to when I get frustrated. plus I'd like someone to give me tasks that Im capable of coding. I don't know any programmers so this is frustrating. i really feel i need to talk to someone rather than post on a message board, is there anything out there that i could use?? aside from college.

The best way to learn c++?
Best way is to have an older brother who has learned.





Second best way is take a class.





Third best way is use a book.





Fourth best way are online tutorials.





Fifth best way is just fool around and figure it out (good luck)





The WORST way is go asking on Yahoo answers for help.
Reply:Why do you say "aside from college?" You don't have to go to four years of college to learn C++. I learned it by taking a single class at a local community college.





In my opinion that's way better than taking some seminar, or trying to learn it from a "Teach yourself C++" book.





Community college courses are typically very cheap and offer night courses so that you can go when you already have a job.
Reply:You might be too frustrated for my suggestion, but I highly recommend "For Dummies" books on C and C++. They explain it in a non-technical manner but you still get the details you need, and they have lots of examples and exercises.
Reply:I know learning a language can be frustrating, especially when you don't have any challenges. I have been there!


In my opinion, try surfing the web and finding different problems, especially programming problems, and questions, and try to code them in C++. I did that, and it really helped me.


For example, I will try to code a program that creates stacks, in the form of linked lists! Then, I will push, pop, is_emp() etc. This will really keep the ball rolling.


Hope this helps, and Good Luck!


Need help in C programming?

i need a c program that displays all factors of a number including one and itself. I can't use arrays, pointers, and strings. I am also not allowed to use other libraries... only stdio.h. help anyone?

Need help in C programming?
Use the mod operator %.





Remember 0 is equivalent to false, and anything else is equivalent to true in C, so you don't need to waste system time with a comparator like (==).





10 % 2 returns false, and that means it's a factor wile


10 % 3 returns true, and that means it's not a factor





the highest factor for any number is that number divided by 2, and the number itself and 1 will always be a factor.
Reply:Well the best way to do this would be to iterate from 1 through to the square root of the number desired. then divide the number by each one, test if fpart(number/possiblefactor) == 0. If it does equal zero then print the possible factor and the result of the division.





Finally check if the number is a perfect square and print that too if it is.
Reply:what is C programming

survey