954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Trace Tables

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.

Tipples
Newbie Poster
1 post since Dec 2011
Reputation Points: 10
Solved Threads: 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?

thines01
Postaholic
Team Colleague
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
 

What do you mean by trace table?

skatamatic
Posting Shark
959 posts since Nov 2007
Reputation Points: 403
Solved Threads: 129
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: