Results 1 to 1 of 1

Thread: vb 2008 console application histograms!

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2011
    Posts
    1

    vb 2008 console application histograms!

    I needed to to make a histogram with catogories of different marks by students from 0-100 using "*" to indicate which mark boundary its is represented horizontally i need it to be shown vertically it is in.il show you my code so far :

    Module Module1

    Sub Main()

    Dim Mark As Integer
    Dim Cat1 As Integer
    Dim Cat2 As Integer
    Dim Cat3 As Integer
    Dim Cat4 As Integer

    Console.WriteLine("Cat1 = 0 to 29 " & "Cat2 = 30 to 39 " & "Cat3 = 40 to 69 " & "Cat4 = 70 to 100 " & "Marks")

    While (Mark <= 100)

    Console.WriteLine("Enter The Mark")

    Mark = Console.ReadLine()

    If (Mark >= 0) And (Mark <= 29) Then
    Cat1 = Cat1 + 1
    Console.WriteLine("That is Cat1: " & Cat1)
    ElseIf (Mark >= 30) And (Mark <= 39) Then
    Cat2 = Cat2 + 1
    Console.WriteLine("That is Cat2: " & Cat2)
    End If
    If (Mark >= 40) And (Mark <= 69) Then
    Cat3 = Cat3 + 1
    Console.WriteLine("That is Cat3: " & Cat3)
    End If
    If (Mark >= 70) And (Mark <= 100) Then
    Cat4 = Cat4 + 1
    Console.WriteLine("That is Cat4: " & Cat4)
    End If


    End While
    Console.WriteLine()
    Console.Write("Marks 0-29")
    For Cat1 = 1 To Cat1
    Console.Write("*")
    Next
    Console.WriteLine()
    Console.Write("Marks 30-39")
    For Cat2 = 1 To Cat2
    Console.Write("*")
    Next
    Console.WriteLine()
    Console.Write("Marks 40-69")
    For Cat3 = 1 To Cat3
    Console.Write("*")
    Next
    Console.WriteLine()
    Console.Write("Marks 70-100")
    For Cat4 = 1 To Cat4
    Console.Write("*")
    Next
    Console.ReadLine()


    End Sub

    how can i show this whole histogram data vertically. If you can help i will appreciate alot thank you
    Last edited by thanjim03; Feb 28th, 2011 at 11:18 AM. Reason: wrong question asked

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width