--Originally published at Programming course

So this assignment was longer than I expected but it was fun

here is what we had to do:

Write a function called find_bananas which receives a single parameter called filename (a string) and returns a positive integer which is the number of times the word (string) “banana”  (or “BANANA” ) is found in the file. The banana can be any case (‘BaNana’ or ‘BANANA’ or ‘banana’, etc) and they can be “stuck together” like “banAnaBANANA” (that counts as two). Create your own test file (plain text) to check your work.

And my codeWSQ11.png


--Originally published at Programming course

So this is what Ken told us to do:

So for this assignment I would like to see you create a function that receives as parameter the name of a file (this would be a string value like data.txt) and your function counts the number of lines and the number of characters in the file which it returns as a single value (but with two values). You will want to look at how to create/define and return a struct value from a function and how to open and read text files line by line

This is my code


And this is the help I used from a guy on Youtube:

Fibonacci series- quiz week 8

--Originally published at Programming course

5978831814_69fd0027af_o fib


In this assignment we saw the number series of Fibonacci, which is basically a mathematical explanation to many things in nature, such as the spirals found in flowers, plants, etc, and the numerical sequence in them.  In the program we made, using a loop I told the user the series. This is the code I used.

And if you want to know more about Fibonacci in art, you can click here and there is a great  easy slideshow.quiz8quiz8-atom

Pictures used:

Quiz 06 part 1

--Originally published at Programming course

So the problem said that we should write this code:

	char c;  
	short s;  
	int i;  
	unsigned int ui;  
	unsigned long int ul; 
	float f;
	double d;  
	long double ld;  
	cout << endl 
  	     << "The storage space for each variable type is:"
	     << endl;
	cout << endl << "char: \t\t\t%d bits",sizeof(c)*8;  //  \t means tab 
	cout << endl << "short: \t\t\t%d bits",sizeof(s)*8;
	cout << endl << "int: \t\t\t%d bits",sizeof(i)*8;
	cout << endl << "unsigned int: \t\t%d bits",sizeof(ui)*8;
	cout << endl << "unsigned long int: \t%d bits",sizeof(ul)*8;
	cout << endl << "float: \t\t\t%d bits",sizeof(f)*8;
	cout << endl << "double: \t\t%d bits",sizeof(d)*8;
	cout << endl << "long double: \t\t%d bits",sizeof(ld)*8;

And then just run it. It was easy because it was just adding stuff like an “int” before the “main()”. The problem began with the couts , but all I had to do was to erase the “%” and the “d” in every line and that was it.


quiz6-1 quiz6-1-2

WSQ03-Pick a Number

--Originally published at Programming course

In this program we had to make a random number and the user needed to guess it. If the number was to high or low, the program will tell.

First I made the random number called nu1.

Then I asked the user to guess and using if, I told the user if the number was higher or lower than the random one and made them choose again.

When they guessed the correct number I asked if they wanted to play again and that was it  ?

wsq03-atom wsq03-terminal