Posts

Showing posts from November, 2017

day 22 hw

Image
#include <iostream> #include <fstream> using namespace std; int main(void) { /* Declare variables. */ int se=0,s=0,e=0, r, c, k, maxk=0; int grid[5][5], maxsum[8]={0,0,0,0,0,0,0,0}; double perc; char* direction[8]={"N ","NE ","E ","SE ","S ", "SW ","W ","NW "}; ifstream winds; /* Read and print information from the file. */ winds.open("winds1.txt"); if (winds.fail()) cout << "Error opening  file." << endl;  else  {  for (r=0; r<=4; r++)  winds >> grid[r][0] >> grid[r][1] >> grid[r][2]  >> grid[r][3] >> grid[r][4];  // Determine sums for the direction categories.  for (r=0; r<=4; r++)  {   for (c=0; c<=4; c++)   {   k = grid[r][c];   maxsum[k]++;    if(grid[r][c]==3)    {    e++;    }    if(grid[r][c]==4)    {    se++;    }    if(grid[r]...

Day 18 WH

Image
I couldn't figure out how to get the program to work initially, so I called Sam and he told me that he figured out to replace the underscore with a period for the f_fingertip. The program worked after and I took some time to figure out how to print the count and percentage of each category. Overall the modifications weren't too difficult once you figured out how to print the counts. /* Finger print program*/ /* It then references a function to compute the overall category.*/ #include <stdio.h> int k,l,j,i=0; double pow,pol,poa,arch_2,whorls_2,loop_2;//whorls_2 is equal to i becuase it must be double to calc percentage //pow is percentage of whorls /* Define a structure for the fingerprint information. */ /* The order for fingertips is right hand, thumb to pinky, */ /* and left hand, thumb to pinky. The codes are L for loops, */ /* W for whorls, and A for arches. */ struct fingerprint { int ID_number; double overall_category; char fingertip[10]; }; int ma...

Fritzing schematics project 2

Image