problem in showing array

hi
this is my prog


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  #include <iostream>
#include <fstream>
using namespace std;
main()
{
    float x,y,z,dar,a[10];
    int td,f,co,i=0;
    cin>>co;       //Processing times
    while(co>=0){    
    ofstream list("list.txt",ios::app);
    cout<<"first number:";
    cin>>x;
    cout<<"second number:";
    cin>>y;
    x*=100;  //proccess on fist and second number step 1
    z=(x/y);  //proccess on fist and second number step 2
    z-=100;    //proccess on fist and second number step 3
    i++;
    a[i]=z;
    list<<'%'<<a[i]<<endl;
    co--;
}
for(td=0;td<=i;td++)
cout<<a[i];
}

read this code but why whene while repeats only cout second process time
Topic archived. No new replies allowed.