0

Okay I am pretty knew to c# and I am struggling to learn it.

However back to my question how do I record a trace table for example this is the code I have:-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        
        {
            double numBooks = 0;
            int count = 0;
            double bookPrice = 0.0;
            double totalCost = 0.0;
            string numBooksstring;
            string bookPricestring;
                

            Console.WriteLine("Enter number of books required");
            numBooksstring = Console.ReadLine();
            numBooks = double.Parse(numBooksstring);
            

            // Loop to read the price of each book
            for(count = 0; count < numBooks; count++)
         {
            Console.WriteLine("Enter Price");
            bookPricestring = Console.ReadLine();
            bookPrice = double.Parse(bookPricestring);



            totalCost = totalCost + bookPrice;	// Keep running total
        }

            Console.WriteLine(totalCost);	// Display total cost

            Console.ReadLine();


        }
    }
}

It's basic code, but I can't seem to get my head around which button I need to press to record the trace table for 4 loops.

Edited by Narue: added code tags

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by skatamatic
0

You can press F9 to set a breakpoint on a particular line of code.
You can also right-click the element and "Add Watch" to see the results in action for a particular variable or object.

Is that what you meant?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.