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.

Recommended Answers

All 2 Replies

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?

What do you mean by trace table?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.