Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php on line 152
‘#333333’ Articles at TC101 Fall 2015
Introduction to Programming Python and C++

Tag Archives: #333333

#mastery18

this Mastery might sound too complicated but in fact it is too easy to regard this mastery is known in Spanish as conditional nested , and no forces have to be an if as it is not the only type of conditional exists, nested conditional m…

#matery09

En este mastery podremos ver todos los tipos de variables que pueden ser usados al programar en c++.

 

Las fundamentales, en c++ existen 6 tipos fundamentales de variables, en cambio en c solo existen 5 ya que c++ se le agrega el tipo de variable bool; los 6 tipos de variables que podemos usar en c++ son los siguientes:

  1. void
  2. char
  3. int
  4. float
  5. double
  6. bool

Void:

void es un tipo especial de variable el cual indica la ausencia de tipo, se usa para indicar el valor de retorno en funciones que no returnan ningun valor y tambien para indicar la ausencia de parametros en funciones que no lo requieren, esta, aun que es una variable opcional en c++, en c por otro lado, es una variable que obligadamente hay que conocer y usar

Char:

Es el tipo alfanumerico, es decir, que puede contener un numero o un signo de puntuación, en lo cual, desde el punto de vista del ordenador todos estos son caracteres. su tamaño de memoria es de 1 byte o un octeto, hay que notar que un char es tratado como un número en lo cual este puede tener un signo positivo o negativo, y este puede tomar el valor desde -128 a 127  y usando el tipo de modificador unsigned encuentra valores desde 0 a 255

Para definir una variable se puede hacer de la siguiente manera

char perro=1;

int:

Existen diferentes tipos de int gracias  a los modificadores, pero al mismo que el int normal sirven para almacenar numeros enteros; desgraciadamente no existen parametros para saber que capacidad tiene cada tipo de int por lo tanto no sabremos cual es el rango que abarcarn, pero aun asi sabemos cual puede ser mas grande que cual, por lo tanto quedaria asi, teniendo el primero como el mas pequeño y el ultimo como el mas grande:

  • short int
  • int
  • long int
  • long long int

float:

Este tipo de variable es una variable la cual arriesga precision por tamaño  haciendola una combinacion de una variable muy util y una impresicion aveces considerable, pero lo que caracteriza a estra variable es que son capaces de guardar numeros con decimales ya que utilizan una base de potencias 10 para poder guardarlas ya que la computadora usa un sistema binario.

double:

Este tipo de varible es una segunda version de la variable anterior (float) ya que esta, igual que la anterior puede guardar numeros con decimales, pero a diferencia de esta, es mucho mas precisa al igual que puede guardar mas datos, todo esto con un mayor consumo de memoria.

Para definir una variable se puede hacer de la siguiente manera

double perro=11234.9835284;

bool:

esta variable, implementada en c++ es usada para evaluar expresiones logicas y solo puede tomar dos valores true o false.

Para definir una variable se puede hacer de la siguiente manera

bool perro=true; 

Topic masterie 24 and 25

Here is my video tutorial for the topic masterie 23

link: https://www.youtube.com/watch?v=-NqlHcAQwZY&feature=youtu.be

 

Topic masterie 22

Here is my video tutorial for the topic masterie 23

link: https://www.youtube.com/watch?v=4n8zS35gQ7A&feature=youtu.be

 

Topic masterie 18

Here is my video tutorial for the topic masterie 23

link: https://www.youtube.com/watch?v=st5XH_NzYsg&feature=youtu.be

 

Topic masterie 6

Here is my video tutorial for the topic masterie 23

link: https://www.youtube.com/watch?v=vOhZ0IMeEa8&feature=youtu.be

 

 

#Quiz11

Here´s my quiz 11, it was a little more complicated than I thought, but in the end I receive some help from my friends Marco Patiño and Esaú Preciado, and well they teach me how to do the programms.

so here are my programms

q1.

 <iostream>
<iomanip>
using namespace std;

void newline(){
  cout<<endl;
}

double factor(int a){
double output= 1.0;
for (int i = 1; i <= a; i++){
  if (a == 0)
  return output;
  else
  output = output * i;
  }
return output;
}

double define_e(int exact){
double output1 = 0.0, output2 = 1.0;
for(int i= 1; i<1000 ; i++){
  output1 = output2;
  output2 = output1 + (1/factor(i));
}
cout << fixed << setprecision(exact) << output2 << endl;
return output1;
}
int x = 0;

int main(){
float e;
string z;
cout<<"Hi, I´m a calculator of the e constant "<<endl;
newline();
cout<<"Please insert how precisely you want this mathematical constant "<<endl;
newline();
cin>>e;
newline();
cout<<"The result equals to "<<define_e(e)<<endl;
newline();
}
return 0;
}

 

q2.

 <iostream>
<string>
<fstream>
using namespace std;

int main(){
string Read;
string Banana = "banana";
char archive[50];
int x = 0;
int y = 0;
int counter = 0;
cout << "Write the name of your file: ";
cin >> archive;

ifstream read_file (archive);
if (read_file.is_open()){
while (getline(read_file , Read)){
      x = 0;
      while (x < Read.length()) {
        char character = Read[x];
        if ( character == 'B' || character== 'b'){
          y = x + 1;
          char character = Read[y];

          if (character == 'A' || character== 'a'){
            y++;
            char character = Read[y];

            if (character == 'N' || character== 'n'){
              y++;
              char character = Read[y];

              if (character == 'A' || character== 'a'){
                y++;
                char character = Read[y];

                if (character == 'N' || character== 'n'){
                  y++;
                  char character = Read[y];

                  if (character == 'A' || character== 'a') {
                    counter++;
                  }
                }
              }
            }
          }
        }
        x = x + 1;
}

    }read_file.close();
    }else{
      cout << "Error 404 not found" << endl;
    }
cout << "I found " << counter << " bananas....So eat them all!!!...or not..." << endl;
return 0;
}

Also on github.

Program1.

https://github.com/everibarra/TC101-C-/blob/master/quiz11q1.cpp

Program2

https://github.com/everibarra/TC101-C-/blob/master/quiz11q2.cpp

#Project Advance 3

We finally did the project, we just need to adjust some functions, because we were using functions from theimagemagick library, tomorrow we´re going to change the programm and see if it runs with arrays.

here´s the code:

 <Magick++.h> 
<iostream>
using namespace std;
using namespace Magick;

void newline(){
  cout<<endl;
}

int main(int argc,char **argv)
{
  InitializeMagick(*argv);
  try{
  int x;
  cout<<"Hi, Im a manipulator of images "<<endl;
  newline();
  cout<<"What do you want to do? (press the number in your keyboard) "<<endl;
  newline();
  cout<<"1. Rezise the image to one half of its original size"<<endl;
  cout<<"2. Switch to black and white"<<endl;
  newline();
  cin>>x;
 
  if(x==1){
     newline();
     cout<<"Alright, now introduce the name of the file with its extension; example: new.jpg"<<endl; 
     newline();
     Image image;
     string img;
     cin>>img;
     image.read(img);
     image.minify();
     image.write("resized.jpg");
 }
  if(x==2){
     newline();
     cout<<"Alright, now introduce the name of the file with its extension; example: new.jpg"<<endl; 
     newline();
     Image image2;
     string img2;
     cin>>img2;
     image2.read(img2);
     image2.quantizeColorSpace( GRAYColorspace );
     image2.quantizeColors( 256 );
     image2.quantize( );
     image2.write("blackandwhite.jpg");
 }      
 }
  catch( Exception &error_ )
    {
      cout << "Caught exception: " << error_.what() << endl;
      return 1;
    }
  return 0;
}

#Project Advance 3

This is not the final final project, and It´s not complete.

¡¡¡¡Hi!!!! this is the advance of the project, but we dont know how to change this to pixels or vectors, 

Link to code: 

https://github.com/kenwbauer/TC101F15_Team01/commit/62ff22fecfd823e3d4496eea9a7cdad78116c46d

 <Magick++.h> 

<iostream>

using namespace std; 

using namespace Magick; 

void newline(){

  cout<<endl;

int main(int argc,char **argv) 

  InitializeMagick(*argv);

  try{

  int x;

  cout<<"Hi, Im a manipulator of images "<<endl;

  newline();

  cout<<"What do you want to do? (press the number in your keyboard) "<<endl;

  newline();

  cout<<"1. Rezise the image to one half of its original size"<<endl;

  cout<<"2. Switch to black and white"<<endl;

  newline();

  cin>>x;

  if(x==1){

     newline();   cout<<"Alright, now introduce the name of the file with its extension; example: new.jpg"<<endl;  

     newline();

     Image image;

     string img;

     cin>>img;

     image.read(img);

     image.minify();

     image.write("resized.jpg");

 }

  if(x==2){

     newline();

     cout<<"Alright, now introduce the name of the file with its extension; example: new.jpg"<<endl;  

     newline();

     Image image2;

     string img2;

     cin>>img2;

     image2.read(img2);

     image2.quantizeColorSpace( GRAYColorspace );

     image2.quantizeColors( 256 );

     image2.quantize( );

     image2.write("blackandwhite.jpg");

 }       

 } 

  catch( Exception &error_ ) 

    {  cout << "Caught exception: " << error_.what() << endl;  return 1

    }return 0

}

 

#Project Advance 2

Hi everyone this is the “report” of the project.

This time we are using Imagemagick, Magick++; we can half size the image yeah, but we can’t change the color, ooooooooo u.u, so with this problem we are in a hurry, but we can do it and we feel positive with it because we are in the half of the way to complete this task 🙂

I feel like I´m not doing my best with this project, but here I am trying.

Some links that we found, (more Ever) and  this can help:

http://www.imagemagick.org/Magick++/Color.html#ColorGray

http://www.imagemagick.org/script/perl-magick.php

 

The code:

 

using namespace std;
using namespace Magick;

void newline(){
  coutendl;
}

int main(int argc,char **argv)
{
  InitializeMagick(*argv);
  try{
  int x;
  cout"Hi, Im a manipulator of images "endl;
  newline();
  cout"What do you want to do? (press the number in your keyboard) "endl;
  newline();
  cout"1. Rezise the image to one half of its original size"endl;
  cout"2. Switch to black and white"endl;
  newline();
  cin>>x;
 
  if(x==1){
     newline();
     cout"Alright, now introduce the name of the file with its extension; example: new.jpg"endl; 
     newline();
     Image image;
     string img;
     cin>>img;
     image.read(img);
     image.minify();
     image.write("resized.jpg");
 }
  if(x==2){
     newline();
     cout"Alright, now introduce the name of the file with its extension; example: new.jpg"endl; 
     newline();
     Image image;
     string img2;
     cin>>img2;
     image.read(img2);
     image.quantize(colorspace.gray);
     image.write("blackandwhite.jpg");
 }      
 }
  catch( Exception &error_ )
    {
      cout "Caught exception: " error_.what() endl;
      return 1;
    }
  return 0;
}

 

 

What should you work on?

Week #12 and more partial exams for you.

For this week's readings:
C++ (TC1017) should either be looking at support for your project, ImageMagick C++ libraries are a good start.
Python (TC1014) should be finishing chapter 11 (Dictionaries).