I'm a beginner in C++. I should make program that outputs shape's area.  For example,   Input 1. Square   Input 2. Rectangle   Input 3. Circle   Input 4. Print all the areas  User input: 1  Please give me the side.  The side is: 3  User input: 4  Square area: 9  //////////////////////////////////////////////////////   But there is problem about exception thrown.  I don't know why compiler indicates this. Can someone explain this?   source.cpp:  using namespace std;  int main() {             const int n = 10;     Shape * arr[n];      int input, index = 0;      do     {         cout &lt;&lt; "What shape that you want to create?" &lt;&lt; endl;         cout &lt;&lt; "Input 1. Square \n";         cout &lt;&lt; "Input 2. Rectangle \n";         cout &lt;&lt; "Input 3. Circle \n";         cout &lt;&lt; "Input 4. Print all the areas \n";         cout &lt;&lt; "Input -1. Exit \n";          cout &lt;&lt; "User input: ";         cin &gt;&gt; input;          //Use switch statement to check user's input         switch (input)         {         case -1:             cout &lt;&lt; "You inputted number : -1 \n" &lt;&lt; "The program will be ended. " &lt;&lt; endl;             break;         case 1:             double side;             cout &lt;&lt; "Please give me the side: ";             cin &gt;&gt; side;              arr[index] = new Square(side);             index++;             break;         case 2:             double width, length;             cout &lt;&lt; "Please give me the width and length \n";             cout &lt;&lt; "Width is: ";             cin &gt;&gt; width;             cout &lt;&lt; "Length is: ";             cin &gt;&gt; length;              arr[index] = new Rectangle(width, length);             index++;             break;         case 3:             double radius;             cout &lt;&lt; "Please give me the radius: ";             cin &gt;&gt; radius;              arr[index] = new Circle(radius);             index++;             break;         case 4:             for (int i = 0; i &lt; 10; i++)             {                 cout &lt;&lt; arr[i]-&gt;getName();                 cout &lt;&lt; " area: ";                  cout &lt;&lt; fixed &lt;&lt; showpoint &lt;&lt;                     setprecision(2);                  cout &lt;&lt; arr[i]-&gt;area() &lt;&lt; endl;             }             break;         default:             cout &lt;&lt; "You entered different number mentioned above!" &lt;&lt; endl;         }     } while (input != -1);      delete[] arr;      system("pause");     return 0; }   The compiler shows that Exception thrown at 0x0130C213 in Project.exe: 0xC0000005: Access violation reading location 0xCCCCCCCC.  I don't understand why the compiler shows this.  Please give me any advice!
I know that the compiler will sometimes initialize memory with certain patterns such as 0xCD and 0xDD.  What I want to know is when and why this happens.  When  Is this specific to the compiler used?  Do malloc/new and free/delete work in the same way with regard to this?  Is it platform specific?  Will it occur on other operating systems, such as Linux or VxWorks?  Why  My understanding is this only occurs in Win32 debug configuration, and it is used to detect memory overruns and to help the compiler catch exceptions.  Can you give any practical examples as to how this initialization is useful?  I remember reading something (maybe in Code Complete 2) saying that it is good to initialize memory to a known pattern when allocating it, and certain patterns will trigger interrupts in Win32 which will result in exceptions showing in the debugger.  How portable is this?
example of compact operator Let $E=l^p=\left\{x=\left(x_n\right): x_n\in\mathbb{R}, \sum_{1}^{\infty}\left|x_n\right|^p&lt;\infty\right\}$ with $1\le p&lt;\infty$, $\left\|x\right\|_E=\left(\sum_{1}^{\infty}\left|x_n\right|^p\right)^{1/p}.$ Let $\left(\lambda_n\right)$ is a bounded sequence in $\mathbb{R}$ and consider the operator $T$ defined by $$T(x)=\left(\lambda_1x_x,\ldots,\lambda_nx_n,\ldots\right)$$ where $x\in l^p$. Prove that $T$ is a compact operator from $E$ to $E$ iff $\lambda_n\rightarrow 0$.  Can anyone give me some hints to solve this problem? Thank you! How can I control HDD spin down time? I have 2 HDDs in my PC. Ubuntu is turning off the secondary HDD very quickly after about 15 minutes, which is short for me. I need to control this time. How can I do it?  I tried GNOME power management but did not find it useful. Is there a way to disable recovery mode so it won't be possible to factory reset your phone?  Basically what I am trying to do, is that it should be impossible to factory reset the phone as there is no recovery partition.  (Example format the recovery partition, or hide the option of factory reset on the recovery menu, build a custom recovery etc.)  P.S.. I was thinking of maybe removing a system app (example package installer) and making it a user app, and therefore when you factory reset the phone it won't start cause the system app is missing, but when I tried that, the phone wouldn't start even without resetting it, as the system needs the system app to start, ( I thought that maybe even though I removed the app from being a system app, the phone would still start as it's still there as a user app, and only after resetting the phone - that the user apps get deleted, the phone won't start as it's missing the app).  Thanks in advance A ring without the Invariant Basis Number property I was reviewing my homework and it seems I overlooked something crucial while proving some ring has no Invariant Basis Number property. This is exercise VI.1.12 in Aluffi's Algebra: Chapter 0  The setup: $V$ is a $k$-vector space and let $R = \mathrm{End}_{k}(V)$.   Prove that $\mathrm{End}_{k}(V\oplus V) \cong R^4$ as an $R$-module Prove that $R$ doesn't satisfy the IBN property if $V = k^{\oplus \mathbb N}$.   For the first, I used to the fact that $V \oplus V$ is both the product and coproduct (in $k$-Vect) of $V$ with itself to get the isomorphism. What I just realized is I only showed that the two are isomorphic as groups not $R$-modules. So what would be the $R$-module structure on $\mathrm{End}_{k}(V \oplus V)$?   For the second, I used the fact that $V = k^{\oplus \mathbb N}$ implies $V \cong V \oplus V$ which in turn implies $R = \mathrm{End}_{k}(V) \cong \mathrm{End}_{k}(V \oplus V)$. Again, I just realized that I only showed the latter two are isomorphic as groups.   It may be obvious (and maybe why my professor let it pass?) but I can't come up with a good $R$-module structure that makes the two group isomorphisms $R$-linear.  Edit:  Explicitly, these are the isomorphisms I'm dealing with. Let $\pi_j, i_j$ be the natural projection/inclusion maps of the $j$-th factor resp. and $\psi: k^{\oplus \mathbb N} \oplus k^{\oplus \mathbb N} \to k^{\oplus \mathbb N}$ the isomorphism given by $\psi(e_i, 0)=e_{2i-1}$ and $\psi(0, e_i)=e_{2i}$.  Then the first isomorphism $\mathrm{End}_k(V \oplus V)\to R^4$ is given by $\varphi \mapsto (\pi_1\varphi i_1,\pi_2\varphi i_1,\pi_1\varphi i_2,\pi_2\varphi i_2)$  The second isomorphism $R \to \mathrm{End}_k(V \oplus V)$ is given by $\alpha \mapsto \psi^{-1} \alpha \psi$  The composition doesn't seem to be $R$-linear if I use the obvious $R$-module structure on $R$ and $R^4$. Changes to "close as duplicate" (part deux) Books for a beginner I am a student of 11th grade and i have completed the syallabus of both 11th and 12th grade maths with complete understanding and it was possible coz of the love for this subject that i have. I don't want to sound "larger than life" here, but my curiousity has now increased to learn maths at a deeper level. As of now i am reading "Linear algebra done right" by Axler. Thats an amazing piece of work and now i truly understand what "matrix" is all about. I also want to extend my knowledge on the following topics :  1) Algebra (groups,subgroups,homomorphisms etc)   2) Analysis   3) Geometry/Topology  Why i am here is because i wanted you guys to recommend a book on each of the above topic that would be appropriate for a beginner like me (I must mention here I have been working on Apostol's volume 1 calculus, thats a great text, but for a beginner, its best if the concept is explained in a broad manner and in as simple and easy words as possible) . I just want a book which explains the concept broadly rather than coming to the conclusion directly (which is not a great sight for a beginner like me) .   Having said that, no book is complete i understand. Thats why i am asking your recommendation as you guys are aware which text would be the best to start with for a beginner. I have searched on the net about this, but there are dozens of works available, and out of them all , i want the one which is the best (approximation) for a beginner .   Please don't misunderstand me in any way. I am just confused which text to go for, and i understand the books which u may suggest may be for undergraduate level course as these topics are for undergraduate level courses, thats not a problem at all . I need a easy to learn (i mean easy in terms of "broad" explanation) book. I hope you guys don't mind me questioning such a question on this forum . Thanks for all the help you guys have been providing me on this forum . Maths Maths Maths... the world is beautiful coz of u! :)) Is there a way I can share the 3.42 GB download of Windows 8.1 from Windows Store? I am using a 36 V battey pack (10s 2.5 A each cell 3.6V.) Its maximum voltage is 42 V. I am using a STM32 microcontroller whose input is 3.3 V.  I am designing a PCB in which the power supply is drawn from the battery pack (42 V.) I would like to power the STM32 microcontroller from the battery pack power supply.  I would like to regulate 42 to 3.3 V so that I can power my STM32 microcontroller.   Which method is best to convert it either using regulator or buck converter based on the pcb designing?  Battery Specification: 10s1p   Battery pack nominal voltage: 36 V Battery pack maximum voltage: 42 V Battery pack current: 2500 mAh   Microcontroller specfication: STM32F401RCT6   Supply voltage: 3.3 to 3.6 V Supply current: 100 to 160 mA     Which method or component is best to regulate 42 V so that I can power my microcontroller with 3.3 V? Supremum of a product measurable function... What is the "Bootable flag" option when installing a distro? Is the "bootable flag" needed in today's distributions? If not, then why is it still in the installers? What is it exactly? How do you reset the sa password? I lost the sa password on a machine, and when I log in to the machine directly using an account in the admin group, SQL Server Management Studio will not allow me to log in using Windows authentication.  My plan was to simply log into the server, connect via Windows Authentication, and reset sa to use a new password. Since I cant' connect via Windows Authentication, this won't work.  How else can I reset the sa password? I just started real analysis.  I don't have a background in proofs or logic, simply calculus.  So I'm trying to learn more about proofs--so forgive the basic question, please.  How do you go about proving this theorem: If $a$ and $b$ are any numbers, then there is one and only one number $x$ such that $a + x=b$.  This number is given by $x=b+(-a)$.  First part of the proof I understand--it's simple.  We simply use some axioms and do the following:  $a+b-a=b$, which of course is true.  This is just true from plugging in the $b+(-a)$ for $x$.  But how about the uniqueness issue?  In my text, it says:  $$(a+x)+(-a)=b+(-a) x=b+(-a)$$  How does this prove uniqueness?  Is this equation essentially saying that the ONLY possible value of $x$ is expressed by $b+(-a)$?  How would I have known to set this up as part of the proof if I was asked to prove something is unique?  Sorry for the basic question--have to start somewhere. The version of python2 on my Ubuntu 14.04 machine is Python 2.7.6. How can I upgrade it to the the latest version of Python 2.X? The latest is currently 2.7.11.  I have tried apt-get update/upgrade, but the repository doesn't seem to have the latest version. How do I fix my USB drive to get its original 8GB size back? My USB drive used to be originally 8GB when I bought it.  I'm trying to reformatted in Windows 7 by right clicking on the drive and selecting Format.... But the capacity only shows 250MB.  Is there something I can do to get the original size back? Maybe it got partitioned in a weird way?   The  flash drive is a SanDisk Cruzer Micro 8GB. I got it from Wal-Mart but this is the same drive. Suppose k is an integer such that $6k + 1$, $12k + 1$, $18k + 1$ are primes. Show that $n = (6k + 1)(12k + 1)(18k + 1)$ is a Carmichael number. Suppose k is an integer such that $6k + 1$, $12k + 1$, $18k + 1$ are primes. Show that $n = (6k + 1)(12k + 1)(18k + 1)$ is a Carmichael number.  This is a question on a past exam that I find difficulty to answer. Can anyone help? Plot Summary/Details  A human spacecraft lands on an alien world.  I'm not sure if they are exploring, or touched down for repairs. The world is a foreboding place, and home to a vicious predator that somewhat resembles a panther, or other big terrestrial cat. The creature is quite cunning, and ambushes several crewmen when they are scouting the planet or doing some other activity that would have them isolated and away from the ship. It sticks in my mind the creature is very strong, and able to bite through the heavy spacesuits the men wear with ease.  The creature has an unusual nutritional requirement of some sort. As such, it doesn't eat its victims, but somehow drains them of a particular element or chemical substance. I can't remember what it is, though I think it had something to do with the skeletal structure of the men. Calcium, maybe?  I have only very general recollections of how the story ends/is resolved. The humans become aware of the threat, and I believe they ultimately slay the beast. I can't recall anything more specific than that, unfortunately.  Timeframe of Publication  This one is old, I'm sure of that. I can remember the writing style and some of the descriptions being very "old school" - spacemen, rocketship, that sort of thing. Almost like something you'd see in an old sci-fi movie serial, to use a film analogy. If I had to guess, I'd say 1950's at the latest. Why is orbital angular momentum not 0 when spin and linear momentum are not collinear?   Why can it be 0 when spin and linear momentum are parallel?  Like in the example of a scalar field at rest decaying into an electron and a positron via interaction $\frac{1}{2}g\phi \bar{\Psi}\Psi $   If spin is along x axis and three-momenta is along z axis, decay rate will be 0 if two spins are opposite because orbital momentum is not 0 after decaying. How do I backup my Stackexchange favorites for offline use? Trying to attach a file from SD Card to email I am trying to launch an Intent to send an email. All of that works, but when I try to actually send the email a couple 'weird' things happen.  here is code   Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.setType("image/jpeg"); sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Photo"); sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://sdcard/dcim/Camera/filename.jpg")); sendIntent.putExtra(Intent.EXTRA_TEXT, "Enjoy the photo"); startActivity(Intent.createChooser(sendIntent, "Email:"));   So if I launch using the Gmail menu context It shows the attachment, lets me type who the email is to, and edit the body &amp; subject. No big deal. I hit send, and it sends. The only thing is the attachment does NOT get sent.  So. I figured, why not try it w/ the Email menu context (for my backup email account on my phone). It shows the attachment, but no text at all in the body or subject. When I send it, the attachment sends correctly. That would lead me to believe something is quite wrong. Do I need a new permission in the Manifest launch an intent to send email w/ attachment? What am I doing wrong? Why are my textures pink? Basically, I applied my textures by taking each individual object, unwrapping it in the uv editor, then opening up an image in the uv editor and it would apply the texture in the 3D editor. However, when I render my project none of the textures appear and everything looks odd. I don't know how to set up the images properly with the bee.  For example, here's the uv layout image for the bee's Cube.001:     How do I get that applied properly to the Cube.001 in my project?  Here is   Everything appears purple if the images aren't there and I don't know how to fix that either.