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

Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 

Recently uploaded (20)

Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 

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