
-----------------------------------
jamonathin
Tue Apr 26, 2005 11:31 am

For Loop Trouble . . .
-----------------------------------
Hey, i was trying to make just some simple multiplying program, where it asks to input two numbers, and gives the sum of them.  After I enter the first number, the program finishes.  Any ideas?
#include 
using namespace std;

int numb,numb2,result;
int main (){cout numb;return 0;}
int main2 (){coutnumb2;return 0;}
int calculate (){cout n1;
   std::cout > n2;
   
   int result = n1 * n2;

   std::cout > number1;
}

template 
void basic_calculator::read_number2(std::istream& in)
{
   in >> number2;
}

template 
void basic_calculator::do_math(operation o)
{
   switch (o)
   {
      case ADD:
         result = number1 + number2;
         break;
      case SUB:
         result = number1 - number2;
         break;
      case MUL:
         result = number1 * number2;
         break;
      case DIV:
         result = number1 / number2;
         break;
   }
}

template 
int basic_calculator::get_number1() const
{
   return number1;
}

template 
int basic_calculator::get_number2() const
{
   return number2;
}

template 
int basic_calculator::get_result() const
{
   return result;
}

And now to show a couple of uses of this:

int main()
{
   basic_calculator bci;
   basic_calculator bcd;

   bci.read_number1(std::cin);
   bci.read_number2(std::cin);
   bci.do_math(ADD);
   
   std::cout  n;
    
    for (int i = 1; int i < n; i++)
    {
        t *= i;
    }

    std::cout  wait;
        
    return 0;
}
Also, if anyone knows where a good help file is, (like Turing's F10), can ya tell me about it, cuz I dun wanna annoy you guys.  Thanks  :D

EDIT: It's kinda wierd wtd and I posted on the same minute, but on his 2000th post!  :hb:

-----------------------------------
wtd
Thu Apr 28, 2005 11:40 am


-----------------------------------
int main is the entry point for the program. Unlike turing which just begins from the top of the code and works its way down, a C++ program starts at the int main method. Calculate() is just a function that you can call.

#include 
using namespace std;

void somefunction ()
{
      cout 