Skip to content
EMPS intranet

Back to top
Hi!   Hi!           Start main()

Try stepping through the code


  Value and type of last evaluated expression: Address of array element: Address of array elementx:  (none)

Your browser does not support the canvas element which will make some the features unavailable.

If you are using Internet Explorer within the University of Exeter try going to the Settings menu (probably the gear shape at the top right of this page), selecting "Compatibility View settings", unchecking "Display intranet sites in Compatibility View" and reloading this page.

Code

 Header...
/* * Given a cheesecake of known mass and calories * calculate various calorific value. * All masses are in grammes. */
int main(){
  ...
//? Input data » double tot_mass=550; » double tot_cals=399*6; » double cals_per_lb=3500; » printf("Calories per 100g:\t%g\n", tot_cals*100/tot_mass); » printf("Calories per 1/4 cheescake:\t%g\n", tot_cals/4.0); » printf("Fraction of cheesecake for 500 Calories:\t%g\n", 500/tot_cals); » printf("Pounds of fat added per cheescake: %g\n", tot_cals/cals_per_lb); » printf("Cheesecakes to put on one stone: %g\n", 14*cals_per_lb/tot_cals); » return 0;
}
Memory

main()

128
129
130
131
132
133
134
135
tot_mass = 550
136
137
138
139
140
141
142
143
tot_cals = 2394
144
145
146
147
148
149
150
151
cals_per_lb = 3500

NB: the actual memory address of each variable is the
address shown plus 4290825264 (0xFFC0CC30).

Show Advanced options

.
Show output (Before looking at the output, work out what you think it put should be and see if you are right.)

Output

Calories per 100g:	435.273
Calories per 1/4 cheescake:	598.5
Fraction of cheesecake for 500 Calories:	0.208855
Pounds of fat added per cheescake: 0.684
Cheesecakes to put on one stone: 20.4678
                                                                                                                                                                                                                                                                       

Validate   Link-check © Copyright & disclaimer Share
Back to top