Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9192717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:59:34+00:00 2026-06-17T20:59:34+00:00

I was asked to do the First Come First Serve Scheduling Program. I cracked

  • 0

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:
Output

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:59:36+00:00Added an answer on June 17, 2026 at 8:59 pm

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First, apologies for repeating a variation of an often asked question. However, I am
Have come against an interesting problem and I'm stumped. Basically on one of our
I look after builds of our products and have been asked to come up
I have been asked to write a (very) simple program for a set of
first off third question I've asked and all have been answered well! So thanks
First of all I am sorry if such problem has been asked because I
I was asked to perform(first time) a task in PHP with PostgreSQL for the
First of all I know similar questions has been asked here, I've checked but
First of all, sorry if this has been asked before. I've done a pretty
On my first job interview, I was asked why did I build my own

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.