forked from IntroCSCI/Bugtastic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
41 lines (37 loc) · 865 Bytes
/
main.cpp
File metadata and controls
41 lines (37 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
using namespace std;
// This program is a simple intro to C++ example of debugging
int main()
{
int age;
string name;
//cannot have space in variable name
char last_initial;
//missing ; at the end of cout
cout<<"Hi. What is your first name? ";
cin>>name;
cout<<"name, what is the first letter of your last name? ";
cin>>last_initial;
//Missing "" between name, last initial and endl
cout<<"Thanks, "<<name<<" "<<last_initial<<"."<<endl;
cout<<"Please also tell me how old you are: " << endl;
cin>>age;
if( age < 12 )
{
cout<<"Hey kid, how do you like school?\n";
}
//missing brackets for if statement
if( age < 18 ){
cout<<"Cool!"<<endl;
cout<<"How's highschool going?\n";
}
else if( age == 18 )
{
cout<<"Hey!"<<endl;
}
else
{
cout<<"Pleased to meet you!\n";
}
return 0;
}