• No results found

Goals of this lab

N/A
N/A
Protected

Academic year: 2022

Share "Goals of this lab"

Copied!
21
0
0

Loading.... (view fulltext now)

Full text

(1)

CS 101

Computer Programming and Utilization

Bharat

with

several CS101 TAs and CSE staff

Course webpage: https://www.cse.iitb.ac.in/~cs101/

Lab1: Getting Started

Clip art and quote credits: Various sources found through Google

(2)

Goals of this lab

• The goal of this lab is to become familiar with the following:

– Ubuntu navigation

– Basic usage of bash/terminal – Web browser, text editor

– Bodhitree interface

– Files, directories, web pages – Codeblocks, s++

(3)

Login into Lab Machines

• You will see a screen similar to this

• Press enter key on your keyboard

• Enter the following password labuser

• Click Unlock.

• You will see ubuntu desktop

screen. Ubuntu is an operating system, an alternative to

Windows and Mac

(4)

Ubuntu Navigation and Directories

• You will see some icons on the left of your desktop

• Click on ‘Files’ icon.

• A window will open up.

• This shows ‘Home’ directory

• You can see some folders

• Currently, ‘Home’ is selected

• Click ‘Downloads’

• All files that you download from the internet will go

(5)

Files

• Way of storing information in various formats

• Files are stored in a directory/folders

• Different file formats have different extensions

• Example

○ Text: .txt, .c, .cpp, .py

○ Word: .doc, .docx

○ Document: .pdf

○ Excel: .xls, .xlsx

○ Libre Writer: .odt

○ Libre Impress: .odp

○ Images: .png, .jpg, .bmp

○ Video: .mp4, .ogg

○ Audio: .wav, .mp3

(6)

Text editor

A software in which you are able to write, save, cut, copy, paste, etc. Examples (gedit, vi, etc.)

• Open gedit by clicking ‘Show Applications icon’,

type ‘gedit’, select. You will see a new file opened up.

Write something into the file. Click ‘Save’

• Write your filename and click ‘Save’ (green button)

(7)

Text editor

● The saved file will look like below

● Click on the 3 horizontal lines, and explore the options

(8)

Text editor

● Locate the file in the directory

● Click on Files folder

● You will be in the home directory.

Select the text file you just created, myfirstfile.txt

● Press Ctrl + c

● Press Ctrl + v

● A new file will be created

Double click to open the new file

● You will see the same content that you wrote

● Change some text and save it. (Ctrl + s)

● Now open the original file (myfirstfile.txt)

● You will see that the original file is not changed

(9)

Web browser

• An application using which we can view the information given on the web (news, sports, songs, movies, etc.)

• Google Chrome, Mozilla Firefox, Safari, etc.

• Click ‘Show Applications’ icon – located in the bottom left

• Type Google chrome and click on the icon

• The browser will open up

• It will look similar to this

URL bar

(10)

Basic Shell commands (Terminal)

• Press Ctrl + Alt + t. A terminal opens up.

• Write pwd and press enter (print working directory)

○ It shows your current folder path

• Write ls and press enter

○ It lists the files and folders in your current folder

• Write mkdir test and press enter (make directory)

○ Creates a folder called test

• Write cd test and press enter(change directory)

○ Changes your directory to test

• Write cd .. and press enter (go one level up)

○ Takes you one level up

(11)

Code::Blocks

• An IDE for compiling and executing C/C++ programs

• Click and type codeblocks. Click

• You will first see Simple::Blocks screen

• A new window will open.

• Select GCC with simpleCPP

• Click Ok

• This screen appears only once

• You may or may not get this screen

(12)

Code::Blocks (Basic Program)

• Save the file

• as hello.cpp

• in your home directory

• Write the following after main_program{

○ cout << “hello”;

• Click Build and run

• A new window opens up

cout << “hello”;

(13)

Code::Blocks (Graphics Program 1)

Create a new file called “square.cpp” in your home directory and write the following program in it.

• Play around with the code as you want and see what happens.

(14)

Code::Blocks (Graphics Program 2)

Create a new file called “polygon.cpp” in your home directory and write the following program.

• Instructions for

running the code are in the next slide

(15)

s++ (Simplecpp)

• Press Ctrl + Alt + t. A terminal opens up.

• Write ls and press enter

• You will see the file ‘polygon.cpp’, and possibly some other existing files

• Write: s++ polygon.cpp

• Press enter. This will compile the program

• Write: ./a.out

• Press enter. This will execute the program.

• Write 5 on the terminal

• Press enter

• The turtle simulator will open up showing a pentagon

• Try running “a.out” again with different values (6,7, etc).

(16)

Preparing for upload

• Click on Files folder

• Create a new folder (Right click > New Folder)

• Write your roll number as the folder name

Copy only hello.cpp, square.cpp, and polygon.cpp in this folder

• Do NOT copy any other file

Right click on the folder > Click compress > Create

• A new file will be created which will be similar to:

○ Rollnumber.zip

(17)

Bodhitree (

http://cs101.bodhi.cse.iitb.ac.in/

)

• All lab related activity will happen on this interface, such as submissions, evaluations, etc.

• Accounts have already been created for everyone, with your Roll Number as the user ID as well as the

password.

• After the first login, please change the password to something you can remember.

• You have been enrolled in “CS101 Winter 2020” course automatically. This is the page for the course.

• Detailed steps are on the next slides

(18)

Webmail

• Open your webmail (webmail.iitb.ac.in)

• You would have received the

email similar to this one.

• Click on the link given in the

email

(19)

Bodhitree

• Create a password for your account. Click ‘Submit’

• You will see CS101 Winter 2020 listed. Click on the link and explore

(20)

Assignments

As a part of this lab, you need to submit the .zip file (containing the 3 programs) which you just created

Login into http://cs101.bodhi.cse.iitb.ac.in/

Select CS101 Winter 2020 → Programming Assignments

Click Lab 1 → Choose file → Double click the .zip file you just created (YourRollNo.zip) Upload

Click Run Practice Test case

(21)

Homework / Extra work

Try out simplecpp programs done in the class

References

Related documents

Providing cer- tainty that avoided deforestation credits will be recognized in future climate change mitigation policy will encourage the development of a pre-2012 market in

While policies after the COVID-19 pandemic should support business efforts to build more resilient supply chains, equating localization or shortening of supply

The purpose of this paper is to provide a measure and a description of intra-household inequality in the case of Senegal using a novel survey in which household consumption data

The Congo has ratified CITES and other international conventions relevant to shark conservation and management, notably the Convention on the Conservation of Migratory

Although a refined source apportionment study is needed to quantify the contribution of each source to the pollution level, road transport stands out as a key source of PM 2.5

“Welcome to Netscape Navigator!” in the document window following the Gif. 4# Write a JavaScript code to create a pull down menu box. 5# Write a Java Script program to move a

These gains in crop production are unprecedented which is why 5 million small farmers in India in 2008 elected to plant 7.6 million hectares of Bt cotton which

INDEPENDENT MONITORING BOARD | RECOMMENDED ACTION.. Rationale: Repeatedly, in field surveys, from front-line polio workers, and in meeting after meeting, it has become clear that