SlideShare a Scribd company logo
1 of 7
Download to read offline
1

         UNIVERSITI TUN HUSSEIN ONN MALAYSIA
         FACULTY OF MECHANICAL AND MANUFACTURING ENGINEERING
         BTI 10202: COMPUTER PROGRAMMING



  LAB 1 : Using Integrated Development Environment (IDE)


 NAME              : _________________________________

 MATRICS NO.: _______________ DATE : _________                          (MARKS)



Objectives:   Learn to use the IDE
              1. Write a C program and compile it
              2. Compilation and Linking error exercises
              3. Running the program
              4. Debugging

Procedures:

   1. Go to menu bar File    New     Source File (left click). (Figure 1)




                                      Figure 1
2

2. When a blank screen appears, save the source file using File   Save As. Save the
   file as Lab1_1.c.
3. Type in the below program in the Editor screen.

 /*Program 1*/
 #include<stdio.h>

 main()
 {
          char name[30];
          int born, x,y;

          printf("What is your name: ");
          scanf("%s",name);
          printf("nnWhich year were you born? 19");
          scanf("%d", &born);

                 for(x=born+1,y=1;x<=99;++x,++y)
                 {
                        printf("nHello! %sn",name);
                        printf("nAt 19%d",x);
                        printf("nYou are %d years oldn",y);
                        system("Pause");

                  }
          return 0;
 }



4. Remember to save your program frequently to prevent data loss. After finish
   typing, click the menu bar Execute Compile. If the program is error free then
   the IDE will tell that the compile status is Done. (Figure 2)
5. Next, click Execute Run. A command prompt window will appear. (Figure 3)
3




   Figure 2




Figure 3
4



6. Add a new source file and type the below program and save as Lab1_2.c

 /*Program to find the average of 5 numbers*/

 #include<stdio.h>

 main()
 {
 int count; //variable to count 5 numbers
 float value, avg; //variables for value and average
 float total=0; //set the total to start with 0
 clrscr(); //start with fresh screen
 printf("n**Program to Compute the Average**nn");
 printf("Insert your 5 numbers:n");
 for (count=1;count<>5;count++)
 {
 printf("nnInsert value %d>", count);
 scan("%f",&value);
 total=total-value; //add the given values
 }
 //find the average and print on screen
 avg=total/5.0;
 printf("nThe average is = %.1fn",avg);
 getch(); //wait until key is pressed
 return 0;
 }

7. Compile the program.
8. View the error messages at the Compiler tab at the bottom of your screen.
   Determine the line at which error occurs. Otherwise double click at the Error
   message. List the error messages. (Figure 4)

   __________________________________________________________________
   __________________________________________________________________
   __________________________________________________________________
   __________________________________________________________________
   __________________________________________________________________
   __________________________________________________________________
   __________________________________________________________________
   __________________________________________________________________
   __________________________________________________________________
   __________________________________________________________________
   __________________________________________________________________
   __________________________________________________________________
   __________________________________________________________________
5

   __________________________________________________________________
   __________________________________________________________________
   __________________________________________________________________
   __________________________________________________________________




                                      Figure 4


9. Correct the compilation errors until no error messages appear. Corrected program
    is saved as another name.
10. Run the corrected program and follow the on screen procedures. View the answer
    on screen. What do you think of it?
    __________________________________________________________________
    __________________________________________________________________

11. If there are errors in the answer, do debugging.
12. Go to the corrected program screen.
13. How to debug using Breakpoint.
         a. Set breakpoint(s) where you want the debugger to stop (otherwise it will
            just run the program). To set a breakpoint on a line, just click on the gutter
            (the gray band on the left), or press Ctrl-F5. Set the breakpoints at
            total=total-value and avg=total/5.0. (Figure 5)
6




                             Figure 5

b. Launch the debugger, by pressing F8 or clicking the debug button.
   Observe the source page and the output page. Write down your
   observation to the lines of your code.
   ____________________________________________________________
   ____________________________________________________________
   ____________________________________________________________

c. If everything goes well, the program will start, and then stop at the first
   breakpoint. Then you can step through the code, entering function calls, by
   pressing Shift-F7 or the "Step Into" button, or stepping over the function
   calls, by pressing F7 or the "Next Step" button. You can press Ctrl-F7 or
   the "Continue" button to continue execution till the next breakpoint. At
   any time, you can add or remove breakpoints.
d. You can display your variables (after you reached a breakpoint) in two
   different ways :
   - Click on the Add Watch (shortcut: F4) button, type the name of your
   variable in the dialog, and press OK. If you select a word in the current
   source file and press F4, it will add a watch of the selected text without
   asking for a variable name.
   - Point your mouse over a variable in your source code (if Watch variable
   under mouse is enabled in Environment OptionsID_ENVIRONMENT)
   and it will be added to the watch list. (Figure 6)
e. Check and compile until the program has no error messages. Copy the
   final corrected program.
7




                                   Figure 6
.

    Finalized error free program

More Related Content

Viewers also liked

Unidad v imagen corp.
Unidad v imagen corp.Unidad v imagen corp.
Unidad v imagen corp.smileinfected
 
Diccionario para ingenieros
Diccionario para ingenierosDiccionario para ingenieros
Diccionario para ingenierossmileinfected
 
Metodologia de las 5s
Metodologia de las 5sMetodologia de las 5s
Metodologia de las 5ssmileinfected
 
اسس العرض التقديمي
اسس العرض التقديمياسس العرض التقديمي
اسس العرض التقديميM_taqniyat
 
Ecuador Rainforest Negotiation -Ecuadorian Government
Ecuador Rainforest Negotiation -Ecuadorian GovernmentEcuador Rainforest Negotiation -Ecuadorian Government
Ecuador Rainforest Negotiation -Ecuadorian GovernmentManjit Mohanty
 
Ecuador Rainforest Negotiation -Ecuadorian Government
Ecuador Rainforest Negotiation -Ecuadorian GovernmentEcuador Rainforest Negotiation -Ecuadorian Government
Ecuador Rainforest Negotiation -Ecuadorian GovernmentManjit Mohanty
 
Green Content - ECM an Enabler
Green Content - ECM an EnablerGreen Content - ECM an Enabler
Green Content - ECM an EnablerKV Rajesh
 
Curso de botánica fotos
Curso de botánica fotosCurso de botánica fotos
Curso de botánica fotosToni Gim
 
A White Paper on Mobile ECM
A White Paper on Mobile ECMA White Paper on Mobile ECM
A White Paper on Mobile ECMKV Rajesh
 
Ignition toyota igt
Ignition toyota igtIgnition toyota igt
Ignition toyota igtToni Gim
 
Mongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappeMongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappeSpyros Passas
 
Accuracy of Small-Group Estimation
Accuracy of Small-Group EstimationAccuracy of Small-Group Estimation
Accuracy of Small-Group Estimationjenny_shi
 

Viewers also liked (20)

Unidad v imagen corp.
Unidad v imagen corp.Unidad v imagen corp.
Unidad v imagen corp.
 
BoldNewMoveInAncientIndia
BoldNewMoveInAncientIndiaBoldNewMoveInAncientIndia
BoldNewMoveInAncientIndia
 
5149
51495149
5149
 
Lectura leyess
Lectura leyessLectura leyess
Lectura leyess
 
Diccionario para ingenieros
Diccionario para ingenierosDiccionario para ingenieros
Diccionario para ingenieros
 
Metodologia de las 5s
Metodologia de las 5sMetodologia de las 5s
Metodologia de las 5s
 
La empresa
La empresaLa empresa
La empresa
 
Com&office
Com&officeCom&office
Com&office
 
اسس العرض التقديمي
اسس العرض التقديمياسس العرض التقديمي
اسس العرض التقديمي
 
Steve Jobs - iCon
Steve Jobs - iConSteve Jobs - iCon
Steve Jobs - iCon
 
Familia Brabo
Familia BraboFamilia Brabo
Familia Brabo
 
Ecuador Rainforest Negotiation -Ecuadorian Government
Ecuador Rainforest Negotiation -Ecuadorian GovernmentEcuador Rainforest Negotiation -Ecuadorian Government
Ecuador Rainforest Negotiation -Ecuadorian Government
 
Ecuador Rainforest Negotiation -Ecuadorian Government
Ecuador Rainforest Negotiation -Ecuadorian GovernmentEcuador Rainforest Negotiation -Ecuadorian Government
Ecuador Rainforest Negotiation -Ecuadorian Government
 
Green Content - ECM an Enabler
Green Content - ECM an EnablerGreen Content - ECM an Enabler
Green Content - ECM an Enabler
 
Comparison of l
Comparison of lComparison of l
Comparison of l
 
Curso de botánica fotos
Curso de botánica fotosCurso de botánica fotos
Curso de botánica fotos
 
A White Paper on Mobile ECM
A White Paper on Mobile ECMA White Paper on Mobile ECM
A White Paper on Mobile ECM
 
Ignition toyota igt
Ignition toyota igtIgnition toyota igt
Ignition toyota igt
 
Mongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappeMongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappe
 
Accuracy of Small-Group Estimation
Accuracy of Small-Group EstimationAccuracy of Small-Group Estimation
Accuracy of Small-Group Estimation
 

Similar to Lab 1

Devry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-startedDevry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-startednoahjamessss
 
Devry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-startedDevry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-startedgovendaagoovenda
 
Devry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting startedDevry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting startedshyaminfo04
 
Devry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting startedDevry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting startedash52393
 
CIS 170 Focus Dreams/newtonhelp.com
CIS 170 Focus Dreams/newtonhelp.comCIS 170 Focus Dreams/newtonhelp.com
CIS 170 Focus Dreams/newtonhelp.combellflower82
 
CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   llflowe
 
CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   bellflower42
 
Cis 170 ilab 1 of 7
Cis 170 ilab 1 of 7Cis 170 ilab 1 of 7
Cis 170 ilab 1 of 7comp274
 
Cis 170 Extraordinary Success/newtonhelp.com
Cis 170 Extraordinary Success/newtonhelp.com  Cis 170 Extraordinary Success/newtonhelp.com
Cis 170 Extraordinary Success/newtonhelp.com amaranthbeg143
 
Cis 170 Education Organization / snaptutorial.com
Cis 170 Education Organization / snaptutorial.comCis 170 Education Organization / snaptutorial.com
Cis 170 Education Organization / snaptutorial.comBaileya126
 
CIS 170 Exceptional Education - snaptutorial.com
CIS 170   Exceptional Education - snaptutorial.comCIS 170   Exceptional Education - snaptutorial.com
CIS 170 Exceptional Education - snaptutorial.comDavisMurphyB33
 
Cis 170 c Enhance teaching / snaptutorial.com
Cis 170 c  Enhance teaching / snaptutorial.comCis 170 c  Enhance teaching / snaptutorial.com
Cis 170 c Enhance teaching / snaptutorial.comHarrisGeorg51
 
Cis 170 Education Organization -- snaptutorial.com
Cis 170   Education Organization -- snaptutorial.comCis 170   Education Organization -- snaptutorial.com
Cis 170 Education Organization -- snaptutorial.comDavisMurphyB99
 
Cis 170 i lab 1 of 7
Cis 170 i lab 1 of 7Cis 170 i lab 1 of 7
Cis 170 i lab 1 of 7helpido9
 
CIS 170 Education Specialist / snaptutorial.com
CIS 170  Education Specialist / snaptutorial.comCIS 170  Education Specialist / snaptutorial.com
CIS 170 Education Specialist / snaptutorial.comMcdonaldRyan138
 
CIS 170 Inspiring Innovation/tutorialrank.com
 CIS 170 Inspiring Innovation/tutorialrank.com CIS 170 Inspiring Innovation/tutorialrank.com
CIS 170 Inspiring Innovation/tutorialrank.comjonhson110
 
Debugger & Profiler in NetBeans
Debugger & Profiler in NetBeansDebugger & Profiler in NetBeans
Debugger & Profiler in NetBeansHuu Bang Le Phan
 
CIS 170 Effective Communication - tutorialrank.com
CIS 170 Effective Communication - tutorialrank.comCIS 170 Effective Communication - tutorialrank.com
CIS 170 Effective Communication - tutorialrank.comBartholomew19
 
Cis 170 Effective Communication / snaptutorial.com
Cis 170 Effective Communication / snaptutorial.comCis 170 Effective Communication / snaptutorial.com
Cis 170 Effective Communication / snaptutorial.comBaileyao
 

Similar to Lab 1 (20)

Devry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-startedDevry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-started
 
Devry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-startedDevry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-started
 
Devry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting startedDevry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting started
 
Devry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting startedDevry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting started
 
CIS 170 Focus Dreams/newtonhelp.com
CIS 170 Focus Dreams/newtonhelp.comCIS 170 Focus Dreams/newtonhelp.com
CIS 170 Focus Dreams/newtonhelp.com
 
CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   
 
CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   
 
Cis 170 ilab 1 of 7
Cis 170 ilab 1 of 7Cis 170 ilab 1 of 7
Cis 170 ilab 1 of 7
 
Cis 170 Extraordinary Success/newtonhelp.com
Cis 170 Extraordinary Success/newtonhelp.com  Cis 170 Extraordinary Success/newtonhelp.com
Cis 170 Extraordinary Success/newtonhelp.com
 
Cis 170 Education Organization / snaptutorial.com
Cis 170 Education Organization / snaptutorial.comCis 170 Education Organization / snaptutorial.com
Cis 170 Education Organization / snaptutorial.com
 
CIS 170 Exceptional Education - snaptutorial.com
CIS 170   Exceptional Education - snaptutorial.comCIS 170   Exceptional Education - snaptutorial.com
CIS 170 Exceptional Education - snaptutorial.com
 
Cis 170 c Enhance teaching / snaptutorial.com
Cis 170 c  Enhance teaching / snaptutorial.comCis 170 c  Enhance teaching / snaptutorial.com
Cis 170 c Enhance teaching / snaptutorial.com
 
Cis 170 Education Organization -- snaptutorial.com
Cis 170   Education Organization -- snaptutorial.comCis 170   Education Organization -- snaptutorial.com
Cis 170 Education Organization -- snaptutorial.com
 
Cis 170 i lab 1 of 7
Cis 170 i lab 1 of 7Cis 170 i lab 1 of 7
Cis 170 i lab 1 of 7
 
CIS 170 Education Specialist / snaptutorial.com
CIS 170  Education Specialist / snaptutorial.comCIS 170  Education Specialist / snaptutorial.com
CIS 170 Education Specialist / snaptutorial.com
 
CIS 170 Inspiring Innovation/tutorialrank.com
 CIS 170 Inspiring Innovation/tutorialrank.com CIS 170 Inspiring Innovation/tutorialrank.com
CIS 170 Inspiring Innovation/tutorialrank.com
 
Lab sheet 1
Lab sheet 1Lab sheet 1
Lab sheet 1
 
Debugger & Profiler in NetBeans
Debugger & Profiler in NetBeansDebugger & Profiler in NetBeans
Debugger & Profiler in NetBeans
 
CIS 170 Effective Communication - tutorialrank.com
CIS 170 Effective Communication - tutorialrank.comCIS 170 Effective Communication - tutorialrank.com
CIS 170 Effective Communication - tutorialrank.com
 
Cis 170 Effective Communication / snaptutorial.com
Cis 170 Effective Communication / snaptutorial.comCis 170 Effective Communication / snaptutorial.com
Cis 170 Effective Communication / snaptutorial.com
 

Recently uploaded

DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 

Recently uploaded (20)

DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 

Lab 1

  • 1. 1 UNIVERSITI TUN HUSSEIN ONN MALAYSIA FACULTY OF MECHANICAL AND MANUFACTURING ENGINEERING BTI 10202: COMPUTER PROGRAMMING LAB 1 : Using Integrated Development Environment (IDE) NAME : _________________________________ MATRICS NO.: _______________ DATE : _________ (MARKS) Objectives: Learn to use the IDE 1. Write a C program and compile it 2. Compilation and Linking error exercises 3. Running the program 4. Debugging Procedures: 1. Go to menu bar File New Source File (left click). (Figure 1) Figure 1
  • 2. 2 2. When a blank screen appears, save the source file using File Save As. Save the file as Lab1_1.c. 3. Type in the below program in the Editor screen. /*Program 1*/ #include<stdio.h> main() { char name[30]; int born, x,y; printf("What is your name: "); scanf("%s",name); printf("nnWhich year were you born? 19"); scanf("%d", &born); for(x=born+1,y=1;x<=99;++x,++y) { printf("nHello! %sn",name); printf("nAt 19%d",x); printf("nYou are %d years oldn",y); system("Pause"); } return 0; } 4. Remember to save your program frequently to prevent data loss. After finish typing, click the menu bar Execute Compile. If the program is error free then the IDE will tell that the compile status is Done. (Figure 2) 5. Next, click Execute Run. A command prompt window will appear. (Figure 3)
  • 3. 3 Figure 2 Figure 3
  • 4. 4 6. Add a new source file and type the below program and save as Lab1_2.c /*Program to find the average of 5 numbers*/ #include<stdio.h> main() { int count; //variable to count 5 numbers float value, avg; //variables for value and average float total=0; //set the total to start with 0 clrscr(); //start with fresh screen printf("n**Program to Compute the Average**nn"); printf("Insert your 5 numbers:n"); for (count=1;count<>5;count++) { printf("nnInsert value %d>", count); scan("%f",&value); total=total-value; //add the given values } //find the average and print on screen avg=total/5.0; printf("nThe average is = %.1fn",avg); getch(); //wait until key is pressed return 0; } 7. Compile the program. 8. View the error messages at the Compiler tab at the bottom of your screen. Determine the line at which error occurs. Otherwise double click at the Error message. List the error messages. (Figure 4) __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ __________________________________________________________________
  • 5. 5 __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ Figure 4 9. Correct the compilation errors until no error messages appear. Corrected program is saved as another name. 10. Run the corrected program and follow the on screen procedures. View the answer on screen. What do you think of it? __________________________________________________________________ __________________________________________________________________ 11. If there are errors in the answer, do debugging. 12. Go to the corrected program screen. 13. How to debug using Breakpoint. a. Set breakpoint(s) where you want the debugger to stop (otherwise it will just run the program). To set a breakpoint on a line, just click on the gutter (the gray band on the left), or press Ctrl-F5. Set the breakpoints at total=total-value and avg=total/5.0. (Figure 5)
  • 6. 6 Figure 5 b. Launch the debugger, by pressing F8 or clicking the debug button. Observe the source page and the output page. Write down your observation to the lines of your code. ____________________________________________________________ ____________________________________________________________ ____________________________________________________________ c. If everything goes well, the program will start, and then stop at the first breakpoint. Then you can step through the code, entering function calls, by pressing Shift-F7 or the "Step Into" button, or stepping over the function calls, by pressing F7 or the "Next Step" button. You can press Ctrl-F7 or the "Continue" button to continue execution till the next breakpoint. At any time, you can add or remove breakpoints. d. You can display your variables (after you reached a breakpoint) in two different ways : - Click on the Add Watch (shortcut: F4) button, type the name of your variable in the dialog, and press OK. If you select a word in the current source file and press F4, it will add a watch of the selected text without asking for a variable name. - Point your mouse over a variable in your source code (if Watch variable under mouse is enabled in Environment OptionsID_ENVIRONMENT) and it will be added to the watch list. (Figure 6) e. Check and compile until the program has no error messages. Copy the final corrected program.
  • 7. 7 Figure 6 . Finalized error free program