Help with this code, I have to do a cafeteria survey with 20 students, see code and errors I get, thanks
Dim studentRate(20) As Integer
Dim counter As Integer
Dim starCounter As Integer
Dim frequencies(20) As String
Dim phrase As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
counter = 0
phrase = "Rating" & vbTab & "Frequencies" & vbCrLf
TextBox1.Text = phrase
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
If ComboBox1.Text = "" Then
MsgBox("select rating...")
Else
counter += 1
If counter > 20 Then
MsgBox("all students have rated the food...")
Else
'register student rating
studentRate(counter) = ComboBox1.Text
phrase &= counter & vbTab
'write number of stars
For starCounter = 1 To studentRate(counter)
phrase &= "*"
Next
phrase &= vbCrLf
TextBox1.Text = phrase
If counter > 20 Then
MsgBox("all students have rated the food...")
End If
End If
End If
End Sub
End Class
These are the errors;
1>------ Build started: Project: CafeteriaSurvey, Configuration: Debug Win32 ------
1>Compiling...
1>CafeteriaSurvey.cpp
1>c:\documents and settings\pdmmonte\desktop\simplycpp\tutorial13\exercises\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey.cpp(2) : error C2146: syntax error : missing ';' before identifier 'studentRate'
1>c:\documents and settings\pdmmonte\desktop\simplycpp\tutorial13\exercises\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey.cpp(2) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\pdmmonte\desktop\simplycpp\tutorial13\exercises\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey.cpp(2) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\pdmmonte\desktop\simplycpp\tutorial13\exercises\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey.cpp(2) : error C2146: syntax error : missing ';' before identifier 'As'
1>c:\documents and settings\pdmmonte\desktop\simplycpp\tutorial13\exercises\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey.cpp(3) : error C2146: syntax error : missing ';' before identifier 'Integer'
1>c:\documents and settings\pdmmonte\desktop\simplycpp\tutorial13\exercises\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey.cpp(3) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\pdmmonte\desktop\simplycpp\tutorial13\exercises\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey.cpp(3) : error C2146: syntax error : missing ';' before identifier 'Dim'
1>c:\documents and settings\pdmmonte\desktop\simplycpp\tutorial13\exercises\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey.cpp(3) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\pdmmonte\desktop\simplycpp\tutorial13\exercises\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey.cpp(3) : error C2146: syntax error : missing ';' before identifier 'counter'
1>c:\documents and settings\pdmmonte\desktop\simplycpp\tutorial13\exercises\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey.cpp(3) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\pdmmonte\desktop\simplycpp\tutorial13\exercises\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey\cafeteriasurvey.cpp(3) : error C2086: 'int Dim' : redefinition