I was asked to do the First Come First Serve Scheduling Program. I cracked the code and the program works fine. However I have problem with displaying it in the tabular column.
I want it to be displayed like this:
Pr AT ST WT TAT RR
--------------------------
A 0 3 0 3 1
B 2 6 1 7 1.16
C 4 4 5 9 2.25
D 6 5 7 12 2.4
E 8 2 10 12 6
Average Response Ratio is 2.56
But what I am getting is like this:

The waiting time, turn around time and response ratio appear on the next line after I enter the inputs of Name, Arrival Time and Service Time. I want all the things to appear on the same line.
Can anyone tell me where I am going wrong? Here is my code:
//First Come First Serve Scheduling
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
void main()
{
int at[5],st[5],tt=0,wt=0,tr=0;
char name[5];
float res,tres;
clrscr();
cout<<"\n\tName \tAT \tST \tWT \tTAT \tRR";
for(int i=0;i<5;i++)
{
cout<<"\n\t";
cin>>name[i];
cout<<"\t";
cin>>at[i];
cout<<"\t";
cin>>st[i];
wt = tr - at[i];
cout<<"\t\t"<<wt;
tt = wt + st[i];
cout<<"\t"<<tt;
tr+=st[i];
res=(float)tt/st[i];
tres+=(float)res;
cout<<"\t"<<res;
}
cout<<"\nAverage response ratio is: "<<tres/5;
getch();
}
Any help would be very nice. Thank you all.
The newline is not processed by C++ program, in Windows platform maybe you can try Windows Console APIs or curse libraries(ncurse for example) to change the position of the cursor. Or you can simply write your own functions to process the input. In that case, you should give up the std:cin.