title: I want to calculate the Total price of the items
body: <p>What I am doing wrong ? I want to calculate the total prices of the items and display it. 
  I have described my problem below with the for loop.</p>
  
  <pre><code>#include&lt;iostream.h&gt;
  #include&lt;conio.h&gt;
  
  int T,N;
  
  class item 
  {
      int quantity;
      char name[100];
      float price;
      float Total;
      public:
      void get_data();
      void put_data();
      void calculate();
      void Total1();
  };
  
  
  
  void item::get_data()
  {
      cout&lt;&lt;"Enter the name of the item "&lt;&lt;T+1&lt;&lt;" = ";
      cin&gt;&gt;name;
      cout&lt;&lt;"Enter the quantity= ";
      cin&gt;&gt;quantity;
      cout&lt;&lt;"Enter the price= ";
      cin&gt;&gt;price;
  
      cout&lt;&lt;"\n";
  
  }
  
  void item::put_data()
  {
      cout&lt;&lt;"\n"&lt;&lt;name&lt;&lt;"\t\t   "&lt;&lt;quantity&lt;&lt;"\t\t   "&lt;&lt;price&lt;&lt;"\t\t\t"&lt;&lt;"SR";
  }
  </code></pre>
  
  <p>I want to calculate the total prices of the items but when I started tracing the program. It is not executiong the for loop of function calculate(). That is why I am unable to add the values present in price variable and unable to store it in variable Total.</p>
  
  <pre><code>void item::calculate()
  {
      for(T=0;T&lt;N;T++)
      {
          Total=Total+price;
      }
  
  }
  void item::Total1()
  {
      cout&lt;&lt;"\nTotal Amount= "&lt;&lt;Total;
  }
  
  
  void main()
  {
      int N;
      clrscr();
      cout&lt;&lt;"Enter the Total number of item = ";
      cin&gt;&gt;N;
      item i[100];
      for(T=0;T&lt;N;T++)
      {
          i[T].get_data();
      }
  
      cout&lt;&lt;"\nName of items";
      cout&lt;&lt;"\t\tQuantity ";
      cout&lt;&lt;"\titem price ";
      cout&lt;&lt;"\t\tGST ";
  
      for(T=0;T&lt;N;T++)
      {
          i[T].put_data();
      }
  
          i[T].calculate();
  
  
          i[T].Total1();
  
  
          getch();
  
  }
  </code></pre>