mirror of
https://github.com/ossu/computer-science.git
synced 2024-10-01 01:26:01 -04:00
Intro to CS MIT - Problem set 01
This commit is contained in:
parent
7a8a95fbb9
commit
b67d6559de
@ -1 +1,14 @@
|
||||
# [Introduction to Computer Science and Programming](http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/)
|
||||
# [Introduction to Computer Science and Programming](http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/)
|
||||
|
||||
## Unit 1
|
||||
|
||||
- INTRODUCTION TO 6.00 ✔
|
||||
- CORE ELEMENTS OF A PROGRAM ✍
|
||||
- PROBLEM SOLVING
|
||||
- MACHINE INTERPRETATION OF A PROGRAM
|
||||
- OBJECTS IN PYTHON
|
||||
- RECURSION
|
||||
- DEBUGGING
|
||||
- EFFICIENCY AND ORDER OF GROWTH
|
||||
- MEMORY AND SEARCH METHODS
|
||||
- QUIZ 1
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
|
||||
Write a program that does the following in order:
|
||||
|
||||
1. Asks the user to enter his/her date of birth.
|
||||
2. Asks the user to enter his/her last name.
|
||||
3. Prints out the user’s last name and date of birth, in that order.
|
||||
|
||||
*/
|
||||
|
||||
var answers = 0;
|
||||
|
||||
process.stdin.resume();
|
||||
|
||||
console.log( 'What is your birth date?' );
|
||||
process.stdin.setEncoding( 'utf8' );
|
||||
|
||||
process.stdin.on( 'data', function( input ) {
|
||||
|
||||
var birthDate = '';
|
||||
var lastName = '';
|
||||
|
||||
if ( answers === 0 ) {
|
||||
|
||||
birthDate = input;
|
||||
answers += 1;
|
||||
|
||||
console.log( 'What is your last name?' );
|
||||
|
||||
} else if ( answers === 1 ) {
|
||||
|
||||
lastName = input;
|
||||
|
||||
console.log(
|
||||
'================\n',
|
||||
'Birth date:',
|
||||
birthDate, '\n',
|
||||
'Last Name:',
|
||||
lastName, '\n',
|
||||
'Bye!'
|
||||
);
|
||||
|
||||
process.exit();
|
||||
|
||||
}
|
||||
|
||||
});
|
Loading…
Reference in New Issue
Block a user