But what i look at your source (i cant test it atm since my dosbox got messed by some reason) youre on good road there.I would like to print on either separate, or sequensial screens
Code:
DIM freshSTU(30) AS STRINGDIM freshGPA(30) AS DOUBLEDIM freshA, FreshB, FreshTemp, FreshTotal AS DOUBLEDIM freshX AS INTEGER freshX = 0
Code:
WHILE NOT EOF(1)INPUT #1, stu, class, GPASELECT CASE classCASE "Freshman"freshSTU(freshX) = stufreshGPA(freshX) = GPAfreshX = freshX + 1CASE "Sophomore"sophSTU(sophX) = stusophGPA(sophX) = GPAsophX = sophX + 1CASE "Junior"juniSTU(juniX) = stujuniGPA(juniX) = GPAjuniX = juniX + 1CASE "Senior"seniSTU(seniX) = stuseniGPA(seniX) = GPAseniX = seniX + 1END SELECTWENDCLOSE #1
Code:
FOR freshA = 0 TO 29FOR freshB = 0 TO freshAIF freshGPA(freshB) < freshGPA(freshB + 1) THENfreshTemp = freshGPA(freshB)freshGPA(freshB) = freshGPA(freshB + 1)freshGPA(freshB + 1) = freshTempEND IFNEXT freshBNEXT freshA
Code:
FOR x = 0 TO sophX - 1PRINT x, sophSTU(x), sophGPA(x)NEXT xSLEEP
Code:
' Goes thru XXX because of reason XXXFOR x = 0 TO sophX - 1 PRINT x, sophSTU(x), sophGPA(x)NEXT xSLEEP
Statistics: Posted by bungytheworm — Tue Oct 10, 2006 9:26 am
Statistics: Posted by TheWicker — Mon Oct 09, 2006 7:53 pm
Code:
x = 0FOR x = 0 TO 100PRINT x, sophSTU(x), sophGPA(x)x = x + 1SLEEPNEXT x
Why you grow x + 1 even you are using FOR NEXT loop that does increase value of x every round?Code:
CLSDIM stu AS STRINGDIM class AS STRINGDIM GPA AS DOUBLEDIM freshSTU(100) AS STRINGDIM freshGPA(100) AS DOUBLEDIM freshX AS IntegerfreshX = 0DIM sophSTU(100) AS STRINGDIM sophGPA(100) AS DOUBLEDIM sophX AS IntegersophX = 0DIM juniSTU(100) AS STRINGDIM juniGPA(100) AS DOUBLEDIM juniX AS IntegerjuniX = 0DIM seniSTU(100) AS STRINGDIM seniGPA(100) AS DOUBLEDIM seniX AS IntegerseniX = 0DIM x AS IntegerOPEN "students.txt" FOR INPUT AS #1WHILE NOT EOF(1)INPUT #1, stu, class, GPASELECT CASE classCASE "Freshman"freshSTU(freshX) = stufreshGPA(freshX) = GPAfreshX = freshX + 1CASE "Sophomore"sophSTU(sophX) = stusophGPA(sophX) = GPAsophX = sophX + 1CASE "Junior"juniSTU(juniX) = stujuniGPA(juniX) = GPAjuniX = juniX + 1CASE "Senior"seniSTU(seniX) = stuseniGPA(seniX) = GPAseniX = seniX + 1END SELECTWENDCLOSE #1 ' remember to close file too ;)FOR x = 0 TO freshXPRINT x, freshSTU(x), freshGPA(x)NEXT x FOR x = 0 TO sophXPRINT x, sophSTU(x), sophGPA(x)NEXT x FOR x = 0 TO juniXPRINT x, juniSTU(x), juniGPA(x)NEXT x FOR x = 0 TO seniXPRINT x, seniSTU(x), seniGPA(x)NEXT x
Statistics: Posted by bungytheworm — Sat Oct 07, 2006 2:17 pm
DIM stu AS STRING
DIM class AS STRING
DIM GPA AS DOUBLE
DIM freshSTU(100) AS STRING
DIM freshGPA(100) AS DOUBLE
DIM sophSTU(100) AS STRING
DIM sophGPA(100) AS DOUBLE
DIM juniSTU(100) AS STRING
DIM juniGPA(100) AS DOUBLE
DIM seniSTU(100) AS STRING
DIM seniGPA(100) AS DOUBLE
DIM x AS INTEGER
OPEN "students.txt" FOR INPUT AS #1
CLS
x = 0
WHILE NOT EOF(1)
INPUT #1, stu, class, GPA
SELECT CASE class
CASE "Freshman"
freshSTU(x) = stu
freshGPA(x) = GPA
x = x + 1
CASE "Sophomore"
sophSTU(x) = stu
sophGPA(x) = GPA
x = x + 1
CASE "Junior"
juniSTU(x) = stu
juniGPA(x) = GPA
x = x + 1
CASE "Senior"
seniSTU(x) = stu
seniGPA(x) = GPA
x = x + 1
END SELECT
WEND
x = 0
FOR x = 0 TO 100
PRINT x, sophSTU(x), sophGPA(x)
x = x + 1
SLEEP
NEXT x
Statistics: Posted by TheWicker — Sat Oct 07, 2006 11:57 am
Statistics: Posted by Z!re — Sat Oct 07, 2006 9:13 am
Statistics: Posted by TheWicker — Fri Oct 06, 2006 10:18 pm
Is it my eyes or what but i do see String, String, Double on that .txt file?dim stu as string
dim class as string
dim gpa as integer
Statistics: Posted by bungytheworm — Fri Oct 06, 2006 6:25 pm
Code:
while x < 30 print freshSTU(x), freshGPA(x) x = x + 1 wend
Before the while, you need to set x=0,Statistics: Posted by moneo — Fri Oct 06, 2006 6:15 pm
Statistics: Posted by TheWicker — Fri Oct 06, 2006 2:42 pm
Statistics: Posted by {Nathan} — Fri Oct 06, 2006 1:58 pm
Statistics: Posted by bungytheworm — Fri Oct 06, 2006 8:03 am
dim stu as string
dim class as string
dim gpa as integer
dim freshSTU(30) as string
dim freshGPA(30) as integer
dim sophSTU(30) as string
dim sophGPA(30) as integer
dim juniSTU(30) as string
dim juniGPA(30) as integer
dim seniSTU(30) as string
dim seniGPA(30) as integer
dim x as integer
open "students.txt" for input as #1
x = 0
while not EOF(1)
input #1, stu, class, gpa
if class = "Freshman" then
freshSTU(x) = stu
freshGPA(x) = gpa
x = x + 1
elseif class = "Sophomore" then
sophSTU(x) = stu
sophGPA(x) = gpa
x = x + 1
elseif class = "Junior" then
juniSTU(x) = stu
juniGPA(x) = gpa
x = x + 1
elseif class = "Senior" then
seniSTU(x) = stu
seniGPA(x) = gpa
x = x + 1
endif
wend
while x < 30
print freshSTU(x), freshGPA(x)
x = x + 1
wend
Statistics: Posted by TheWicker — Fri Oct 06, 2006 12:00 am