I am new to C++. Can somebody help me to learn different features of C++, like 
a good tutorial or something. the best program i can make yet is this: 


#include<iostream.h>
#include<conio.h>
void main()
{
    clrscr();
    cout<<" Welcome to CBot- Your utlimate guide to doing any calcutaion of two 
numbers! "<< " \n Please click enter to continue ";
    int a,b,c,min,max,cal,com,ent;
    getch();
    start:
    clrscr();
    cout<<" Please enter the first number ";
    cin>> a;
    clrscr();
    cout<<" Please enter the second number ";
    cin>> b;
    clrscr();
    cout<<" You entered "<< a<< " and " <<b;
    cout<<" \n Please confirm these numbers.Press 1 if the numbers are right 
and press 2 if the numbers are wrong and you wish to re-enter the numbers ";
    cin>>com;
    if (com==1)
    {
        cout<<" You confirmed the numbers. please click enter to see the 
calculation options ";
        getch();
        clrscr();
        cout<<" ADD-1 ";
        cout<<"\n SUBTRACT-2 ";
        cout<<"\n DIVIDE-3 ";        
        cout<<"\n MULTIPLY-4 ";
        cout<<"\n MAXIMUM-5 ";
        cout<<"\n MINIMUM-6 ";
        cout<<"\n Please enter the number corresponsing to the calculation you 
would like to do ";
        cin>>cal;
        if ( cal==1)
{
cout<<" The sum of "<< a<<" and "<<b<<" is "<<a+b;
}
if ( cal==2)
{
cout<<" The remainder of "<< a<<" and "<<b<<" is "<<a-b;
}    
if ( cal==3)
{
cout<<" The divident of "<< a<<" and "<<b<<" is "<<a/b;
}
if ( cal==4)
{
cout<<" The product of "<< a<<" and "<<b<<" is "<<a*b;
}
if ( cal==6)
{
    min=a;
        if (min>b)
        {
        min=b;
        }
                cout<<" the smaller number between "<<a<<" and "<<b<<" is "<< 
min;

        }
if ( cal==5)
{
max=a;
        if (max<b)
        {
        max=b;
        }
                cout<<" the bigger number between "<<a<<" and "<<b<<" is "<< 
max;

        }
}
        if (com==2)
        {
        cout<<" Please press enter to try again ";
        getch();
        goto start;
        }
        cout<<endl<<"\n Hope you enjoyed the program. Press 1 to do another 
calculation. Press 2 to exit the program ";
        cin>>ent;
        if (ent==1)
        {
        goto start;
        }
        if (ent==2)
        {
        clrscr();
                cout<<" Press enter to end the program ";
        getch();
        }
         }


Guys, please make me aware of more things on C++. THanks
This Mail Was Send 2 U By:             coolsb_1...@yahoo.co.in

--- On Thu, 21/1/10, John <jm5...@gmail.com> wrote:

From: John <jm5...@gmail.com>
Subject: [c-prog] Re: Problem with dynamic memory allocation
To: c-prog@yahoogroups.com
Date: Thursday, 21 January, 2010, 6:47 PM







 



  


    
      
      
      --- In c-p...@yahoogroups. com, shamir shakir <dewswo...@. ..> wrote:

>

> So, is there any function to run-time checking here that I can use? 



There isn't anything in the C Standard - I suspect C++ is the same, although 
I'm not a C++ programmer.



Try checking your compiler/IDE documentation - there might be an option that 
adds some sort of checking to the generated code.



> And why did the OS allocated more space ?



The OS might allocate memory in blocks, and the smallest block might be (for 
example) 1k. It might not be the most space efficient algorithm, but it might 
be quicker and simpler than one that allocates exactly the amount you request.



If you are interested, try Googling for 'memory allocation' eg.

http://en.wikipedia .org/wiki/ Dynamic_memory_ allocation





    
     

    
    


 



  






      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. 
http://in.yahoo.com/

[Non-text portions of this message have been removed]

Reply via email to