Sunday, August 2, 2009

When using the quadratic formula to solve a quadratic equation ax2 + bx + c = 0, the discriminant is b2 - 4ac.

When using the quadratic formula to solve a quadratic equation ax2 + bx + c = 0, the discriminant is b2 - 4ac. This discriminant can be positive, zero, or negative. (When the discriminant is negative, then we have the square root of a negative number. This is called an imaginary number, sqrt(-1) = i. )





Explain what the value of the discriminant means to the graph of y = ax2 + bx + c. Hint: Choose values of a, b and c to create a particular discriminant. Then, graph the corresponding equation.


Search the Library and Internet. In the real world, where might these imaginary numbers be used?

When using the quadratic formula to solve a quadratic equation ax2 + bx + c = 0, the discriminant is b2 - 4ac.
Let the discriminant be D = b^2 - 4ac





If D = 0,


there will be equal roots to the equation (i.e one solution)


The graph will "touch" the x-axis at the stationary point of the curve.





If D %26gt; 0


discriminant is positive; equation has two distinct roots (two different solutions). Graph cuts x-axis at two points.





If D %26lt; 0,


discriminant is negative, equation has NO REAL solution (might have imaginary solutions). Graph does not intersect with x-axis.
Reply:if discriminant %26gt;0, the two roots are real and the graph(parabola) cuts the x axis in two points.


if the discriminant is zero, it has two equal roots, the x axis is tangent to the parabola, touches it at one point. if the discriminant is negative, the two roots are complexand the paraboladoes not have intersection with the x axis.


Learning C++?

I'd like to learn how to code native Windows applications using C++. Can anyone recommend a website that will teach me?





I'm using Visual Studio 2005 (I know VB already), but I don't want the final applications to be dependent on the user having the .net framework installed.





What, in simple terms, do MFC and ATL mean? I've gathered that they are some kind of library, but do they need installing on users' computers separately?





Thanks








BTW I do have some basic C++ knowledge regarding command line applications

Learning C++?
MFC is a C++ class library which encapsulates the Windows API. ATL is the advanced template library, it contains stuff for COM programming and GUI programming (i think).





If you want to write native Windows applications, you find a lot of articles on codeguru.com. Also, there's a book by Microsoft Press, written by Charles Petzold, which is a kind of a reference.





The Windows API is a C API. So either you use C functions in C++, or you have to use a C++ wrapper like MFC or WxWidgets or QT.
Reply:MFC was sort of the pre-cursor to .Net. It's not quite as useful to .Net, but if you use that API you get a more organized object oriented layer on top of the Windows API. MFC is standard with Windows, so if you target that API you won't have any dependencies that Windows users won't already have installed.





ATL is just the abstract template library, it's also pretty standard and all Windows installations should have it.
Reply:codeproject .com wud be best for ya





then try gcc compiler





MFC-microsoft foundation classes


atl activex template library


partially yes
Reply:man u doing some crazy work, but i can tell u to have encarter 07 installed, thru web companion and see if that helps.


Please give me short note of my C++ program...?

Problems are taken from C++ Primer book





-Ensure you can complete prior to accepting and emailing me.





-If you do not provide your price to do this I will not respond…





-I require this completed in 1 week.





Exercise 13.3: Assuming Point is a class type with a public copy constructor, iden¬tify each use of the copy constructor in this program fragment:


Point global;


Point foo_bar(Point arg)


{


Point local = arg;


Point *heap = new Point(global);


*heap = local;


Point pa[ 4 ] = { local, *heap };


return *heap;





______________________________________...





Exercise 13.10: Define an Employee class that contains the employee's name and a unique employee identifier. Give the class a default constructor and a constructor that takes a string representing the employee's name. If the class needs a copy construc¬tor or assignment operator, implement those functions as well.





______________________________________...








Among the fundamental operations a pointer supports are dereference and arrow. We can give our class these operations as follows:


class ScreenPtr { public:


// constructor and copy control members as before


Screen %26amp;operator*() { return *ptr-%26gt;sp; }


Screen *operator-%26gt;() { return ptr-%26gt;sp; }


const Screen %26amp;operator*() const { return *ptr-%26gt;sp; } const Screen *operator-%26gt;() const { return ptr-%26gt;sp; } private:


ScrPtr *ptr; // points to use-counted ScrPtrclass








Exercise 14.20: In our sketch for the ScreenPtr class, we declared but did not define the assignment operator. Implement the ScreenPtr assignment operator.





______________________________________...





Exercise 14.21: Define a class that holds a pointer to a ScreenPtr. Define the over¬loaded arrow operator for that class.


______________________________________...








Exercise 15.4: A library has different kinds of materials that it lends out—books, CDs, DVDs, and so forth. Each of the different kinds of lending material has different check-in, check-out, and overdue rules. The following class defines a base class that we might use for this application. Identify which functions are likely to be defined as virtual and which, if any, are likely to be common among all lending materials. (Note: we assume that LibMember is a class representing a customer of the library, and Date is a class representing a calendar day of a particular year.)


class Library { public:


bool check_out(const LibMemberk);


bool check_in (const LibMember%26amp;);


bool is_late(const Date%26amp; today);


double apply_fine();


ostream%26amp; print(ostream%26amp; = cout);


Date due_date() const;


Date date_borrowed() const;


string title 0 const;


const LibMember%26amp; member() const;





______________________________________...








Exercise 15.8: Given the following classes, explain each print function:


struct base {


string name () { return basenatne; }


virtual void print(ostream %26amp;os) { os « basename; } private:


string basename;


};


struct derived {


void printO { print (ostream %26amp;os) ; os « " " « mem; } private:


int mem;


};





If there is a problem in this code, how would you fix it?





______________________________________...








Exercise 15.13: Given the following classes, list all the ways a member function in Cl might access the static members of ConcreteBase. List all the ways an object of type C2 might access those members.


struct ConcreteBase {


static std::size_t object_count(); protected:


static std::size_t obj_count;


};


struct Cl : public ConcreteBase


{ /* . . .*/};


struct C2 : public ConcreteBase


{ /* ...*/};





______________________________________...





Exercise 15.25: Assume Derived inherits from Base and that Base defines each of the following functions as virtual. Assuming Derived intends to define its own ver¬sion of the virtual, determine which declarations in Derived are in error and specify what's wrong.


(a)Base* Base::copy(Base*);


Base* Derived::copy(Derived*);


(b)Base* Base::copy(Base*) ;


Derived* Derived::copy(Base*) ;


(c)ostreamk Base::print(int, ostream%26amp;=cout);


ostream%26amp; Derived::print(int, ostream%26amp;);


(d)void Base::eval() const;


void Derived::eval();

Please give me short note of my C++ program...?
This kind of stuff, where you pay for someone who codes for you would be best accomplished at http://www.rentacoder.com or http://www.guru.com
Reply:And that is a fact since it goes against community guidelines and rules and will be *REPORTED*.
Reply:looks good to me


C++ c language?

Assume that you are required to enter a list of strings into a computer, rearrange them


in alphabetical order, and then print out the rearranged list. The strings must be stored


in a two-dimensional character array. Each string will be stored in a separate row


within the array. You may use any suitable string manipulation functions. One of the


library functions that can be used is strcmpi.


strcmpi compares the strings but does not differentiates between upper and


lowercase characters. The function accepts two strings as arguments and returns


integer value, depending on the relative order of the two strings, as follows:


a) A negative value is returned if the first string alphabetically precedes the second


string.


b) A value of zero is returned if the first string and the second string are identical.


c) A positive value is returned if the second string alphabetically precedes the first


string.


If the function strcmpi (string1, string2) returns a positive value then, this


indicates that string2 must be placed ahead of string1 in order to rearrange the


two strings in alphabetical order.


6


Sample output is given as follows:


Enter each string on a different line:


Type ‘END’ when finished


String 1: Panda


String 2: Apple


String 3: Island


String 4: Calendar


String 5: Brown


String 6: Black


String 7: Rainbow


String 8: News


String 9: Ballroom


String 10: Canada


String 11: END


Reordered list of strings:


String 1: Apple


String 2: Ballroom


String 3: Black


String 4: Brown


String 5: Calendar


String 6: Canada


String 7: Island


String 8: News


String 9: Panda


String 10: Rainbow


String 11: END

C++ c language?
Is this just to make someone else do your computer science homework? Never going to become a programmer like that.





Anyway, you should do the following:


1. Assign a second array with the "values" of the words (perhaps a float to store multiple letters)


2. Sort the second array, mirroring your actions on the original. Use quicksort if you can.


3. Say "w00t!"
Reply:What is your question?

send flowers

Where can I read C.L. WIlson's "Lord of the Fading Lands" online for free???

I have been waiting for this book to come out in my library but it's not there. If you know of a site I can go to to read this book, please let me know. And please don't tell me to buy the book b/c I am only 16, meaning:


-I have no $$$.


-i can't drive anywhere.


-i can't buy online.


-i don't have a library card even if it does come 2 my library (my mom canceled it!)





so please help me! i feel like i'm having withdrawal symptoms...


Where is the best page to learn C+ free?

http://library.thinkquest.org/19436/intr...


I am looking something similar for c+

Where is the best page to learn C+ free?
There are some great tutorials/courses available from universities that are available online.





A selection of pdf files used for lectures:


http://www.cs.wustl.edu/~schmidt/C++/





An Introduction to the Imperative Part of C++


http://www.doc.ic.ac.uk/~wjk/C++Intro/





Thinking in C++, 2nd Edition:


http://www-h.eng.cam.ac.uk/help/tpl/lang...





---





C++ Lessons and Topics:


http://www.functionx.com/cpp/index.htm





C++ Language Tutorial:


http://www.cplusplus.com/doc/tutorial/





Online C++ tutorial (incomplete):


http://www.intap.net/~drw/cpp/





There is also a great list of resources and recommended links at http://www-h.eng.cam.ac.uk/help/tpl/lang...





This page was recommended to me a while ago and while c++ is similar to c, maybe it's not what you are looking for:





http://www2.its.strath.ac.uk/courses/c/


Simple C++ question?

i am trying an example from a book and i cant quite get it yet. hope you can help me.





Question: DECLARE A CHARACTER ARRAY, AND INITIALIZE IT TO A SUITABLE STRING. USE A LOOP TO CHANGE EVERY OTHER CHARACTER TO UPPERCASE. (HINT: ASCII UPPERCASE COUNTER PARTS ARE 32 LESS THEN THERE LOWERCASE )





so i have to use this arithmetic way no. no built in function in a library.





this is what i have so and cant figure out.





#include %26lt;iostream%26gt;





using namespace std;





int main()


{


char c[] = "hello world!";





int count = 0;





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


{


count++;


c[i] = i - 32;


cout %26lt;%26lt; c[i];


}


//cout %26lt;%26lt; c;








return 0;


}





i thought i have everything right except the cout %26lt;%26lt; part however you do it.





any help or suggestions..thanks

Simple C++ question?
first of all,you have wrongly declared the counter variable count.


The loop will exit after one pass. Also, it should be c[i]-=32; or


c[i]=c[i]-32;





try this code instead of the for loop


i=0;


while(c[i]!='\0')


{


c[i]-=32;


i++;


}
Reply:The answers above is somehow incorrect, but some users have suggested good stuff.





I am gonna present you with a solution similar to yours, but I have seen some indexing problems with yours, you have to realize an array starts at POSITION 0 not 1, and in the for loop, you just place i++ to increment to the next position from the character array.





But you have to realize that there are incorrect strings and incorrect symbols, a proper way is to do the following:





http://rafb.net/p/GoMp5X43.html


===========================


char c[] = "hello $^^#67world!";





int count = sizeof(c) - 1;





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


{


// Now only convert when it is a small character


if(c[i] %26gt;= 'a' %26amp;%26amp; c[i] %26lt;= 'z' ) c[i]-=32


}





cout %26lt;%26lt; c;


===========================





That will print out the correct line, and all the symbols will stay intact, so "Hello World!" = "HELLO WORLD!"





Now notice the condition i placed? It should be between a to z.





Now that should work correctly since I tested it here.





Good Luck :)
Reply:What do you mean by "can't figure it out"... you need to say what your problem actually is. The code you have posted seems to be a strange mix of C# and C++... this is not going to work, you need to use one language.





"using" is a C# thing. And you aren't using it correctly anyway. The C# "using" statement when used as a precompiler directive, will import a library in the same way that #include did for C++ and C languages.





These are the things you need to think about for this:


1. what to do if a letter is already uppercase


2. how to determine the end of the string (is it null-terminated, or length-prefixed)


3. How to deal with numbers, whitespace, and control characters.





You have an error in your loop. Look at what you did very carefully. First, you set a variable called 'count' to be zero. Then, you declare a loop and a new integer called 'i', and you initialize 'i' to be 1. Then you say that the loop condition is supposed be "i less than count", which is false the first time in, so the loop never runs.
Reply:One little thing to beware of is that you will also be subtracting


32 from the space when i = 5. This will convert that space into a null, which will prematurely terminate the string.