I want my numbers to. Be aligned but how do I do that. Final Exam Weight: 5 Fina
ID: 3790287 • Letter: I
Question
I want my numbers to. Be aligned but how do I do that.Final Exam Weight: 5 Final Exam points earned: 5
Like this example. Plese help simplify it for me
20:19:33. wwgrantekoa la12 -/1010/ project 48) go 20:28:21 tal projl.c: In function main expects argu proj 1.c: 19: 7: warning format if' ",0); printf (R8lf, Fina Exam weight: 20:28:24] wwgrantekoa la12 :-/1010 /project [49] v 20:28:59] wwgrantekoa la 12: -/1010/project 150 J g rojl.c: In function 'main argu roj 1.c: 19: 7: warning: format 'suf' expects printf %5lf, Final Exam Weight: 0) [20:29:00] wwgrantekoaua12:-/1010/project 151] v [20:31:22] wwgrantekoala12:-/1010/proje [52] g [20:31:23] wwgrantekoala12:-/1010/projett [53] Final Exam Weight:5 Final Exam Points Earned:5 Final Exam Total Points:5 Exam 1 Weight:5 Exam 1 Points Earned
Explanation / Answer
1) you can hard code it, as in simply put enough spaces after "Final exam weight " (like this) so that the input cursor automatcally starts from their and the output appears to be aligned.
2) or you can use the goto function to point the cursor to a certain fixed co-ordinate (x,y) with x fixed so that they are aligned like this ---
--------
#include <iostream>
#include <cstdio>
#include <conio>
using namespace std;
int main() {
int a,b,c;
gotoxy(10,10);
printf("enter final weight:");
gotoxy(50,10);
scanf("%d",&a);
gotoxy(10,20);
printf("enter final points earned:");
gotoxy(50,20);
scanf("%d",&b);
gotoxy(10,30);
printf("enter exm totl points:");
gotoxy(50,30);
scanf("%d",&c);
return 0;
}
---------------
** if you don't have turbo c compiler use this for the gotoxy function
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.