C homework – Shopping cart application

The homework for the session 2 was to create a shopping cart application that allow us to manage products, purchase products, add products, display products and generate a bill if you purchase some items in our application.

I’m going to explain my code, first you have to call the libraries you are going to use, in this case we are using three libraries 1First we are going to declare our functions before our funtion main3and also create our structs like Product and BillstructsThen in our function main we are going to see how it works, we give to you at first 4 options: manage product, purchase a product, generate a bill or exit and with a while we evaluate the input 2the principal functions in our function main are 3: manageProduct, purchaseProduct, generateBillmanageproductbefore seeing this functions we have to define our structs who is calling a function called updateProductstructfindupdateproductThen continuing with our first menu in the manageproduct function we are going to display 3 options add a product, display all products or be back at the first menuaddproductdisplayallproduct

then we have purchase a product, here we are going to ask if you want to purchase some items one by onepurchaseproduct

and finally we have the generateBill function that generates a bill with the items that we purchase in the second optiongeneratebillAnd that’s all the structure of the code, if you want to get the code, you can check it in my repository here.

Anuncios

Session 2 : C programming

We are going to learn programming in C in Linux with nano, the first thing that we had to do was create a directory called part-1 and there create a file with the command touch called hello_world_1.c but before we try to open it with nano we have to install obviously nano

fi1.pngNow, we are ready to open the file with nano, just type nano hello_world_1.c

fi2

First  gcc -c hello_world_1.c compiles hello_world_1.c into a machine code file named hello_world_1.o and then links hello_world_1.o with some system libraries to produce the final program hello_world_1.exe in this case

ccccc.png

So, finally we can run this first example with ./hello_world_1.exe

fifififi.png

Now we will create in part-1 the directory called example-02 and there create the file hello_echo_1.c

2

Open it with nano and type all this

ya

Then we are going to do the same thing that we did in the first example

4

And finally we can run hello_echo_1

6

We wanted to upload to our repository in github just the files which have the code, so we create the hidden file .gitignore

7

with vi we type this

8

then we notice that we have it with the command ls -a to show the hidden files

9

Now in another directory called example-03 we are going to do the example 3 called hello_strings_1.c , in the picture I was wrong with the name so I renamed it with the command mv

12

Now type all this for the example

13

We have to the files .o and .exe to run our program and this will be the output

14

For the fourth example, we are going to do something new, create the file Makefile and also create the program called hello_structs.c

1

We open Makefile and type this to replace our command gcc

2

Now open the file hello_structs_1.c and type this

3

4

We said that with Makefile we are going to replace gcc, so now we will type make clean to remove our file .o and .exe, for that reason when we type ls -1 we have only two files hello_structs_1.c and Makefile, then with make we are going to create .o and .exe files and finally with make run we have the output of the program

5

And that’s all, we have to upload it in our repository 6

You can visit my repository here.

Upgrading to Fedora 27 Beta

Fedora 27 Beta was released last week and we are going to upgrade our fedora 26 to fedora 27 Beta. We can see our fedora release with this command

3

Then with the following command we are going to tell to the Software application for detecting the availability of a prerelease, in this case Fedora 27 Beta.:

1

And if you don’t want to wait for the Software service to refresh its information, you can force it to do this with this command:

2

Now open the Software app. Click on the Updates tab. After a short time or also if the update is not there you have to restart your computer, then the Software app retrieves fresh information about the prerelease.

Use the Download button to download the upgrade data for Fedora 27 Beta. Finally we have to follow the steps to reboot and install the upgrade, which will take a lot of time. When your system restarts after the upgrade, we can check that certainly we have fedora 27 😀

fiiiii.png

 

First session of GSoC Training Road to 2018

We met in the classroom 314 at the UIGV to start the first session of GSOC Training, I noticed that all the guys in the classroom were very enthusiastic about the GSOC, all of us want to apply to this program and be one of the winners.

Google-Summer-of-Code-March-3-2017

We are students from differents universities in Peru like UNI, UNMSM, UNTELCS, UPIC, PUCP, and we are in the proccess of learning about linux and programming.

It’s important to know about the history of the free software because we need to know the philosophy to share with other people and help other people to be involved in free software, for that reason our trainer Julita Inca was telling us how it begin and how it were growing at time.

For that reason before you start to get involved in this world of free software you have to remember all the time this simple four tips:

0.  Freedom to run the program as you wish.
1. Freedom to study the source code of the program and then change it so the program does what you wish.
2. Freedom to help your neighbour. That’s the freedom to redistribute the exact copies of the software when you wish.
3. Freedom to contribute to your community. That’s the freedom to distribute copies or modified versions when you wish.

richard-stallman-barcelona_1_carrousel_bootstrap

The first thing we are going to do is learn some basic commands on linux. We start with the command pwd: print working directory, to know where we are located in the computer

unnamed

then we use cd to move another directories, ls to show the directories and archives and pwd to know where we are located

image

one thing I didn’t know was that with the command ls -a we can see the hidden archives and those are identified with a dot after them, also we can create hidden archives putting a dot after the name of the archive. For example I clone a repository called Linux in mi computer and when you clone a repository, it create a hidden archive called .git

image (1)

It’s also important to know how to manage the content of an archive, so you can edit it, that’s why we started to see how to manage vim.

Some examples here:

 

There are a lot of commands in Linux and for the end of the day I think that we won’t never know everything about it but fortunately we like the challenges so we can keep it in that way of continue learning.

 

Thanks to all the guys in the group and to our trainer Julita 😀