We started the lecturing by going over the labs we had completed. My code worked just fine but I have to be more specific by my variable names.
There is no way to tell what I was talking about if I wanted to go back and change this later. Plus, anything more complicated will immediately have be forgetting such generic symbols. I will work on this for my next lab.
After that, learned how to define variable we want. I can decide my useful constants for the program and not have it close to hand through my entire program.
Then we learned about priority on operators, It was similar to order of operations. One to remember is making the code readable by formatting,
Something like this makes it obvious what's happening. Also, when we have longer calculations it's smart to break it into steps, Not only does this make the coding a little easier; troubleshooting is naturally structured to proceed in bite-sized bits.
We also need to watch out for overflow and underflow. This hammers home the idea of knowing how you are assigning space in the memory.
we also did some practice with incrementing and decrementing variables. once thing to remember is that when you uses the ++ or -- operators as suffixes then it will not actually apply until after other operations have been completed.
We also learned about control strings and conversion strings. As far as I can tell, control strings will be used to preform an action and is inside quotations.
That \n tells the program to put in a line break.
convertion strings are used to tell the computer what sort of value it should be using. This also run the risk of being misused and then screwing the program. The example we used was casting %i as %c and getting back an Ascii equivelant for an answer. 2 + 2 = d
The ability to take in inputs also came up today.

It's used like printf. First you have to use a conversion string to prompt the computer what is about to be scanned, The &year tells the computer where to house the scanned information. This is a possible problem, For instance, trying to store a float in an int.. Also, don't forget those "" around the conversion.
Homework
Started by using the process we learned during class.

//-------------------------------------------This is the original problem---------------------------
#include<stdio.h>
#include<math.h>
int main()
{
float femur, humerus, MheightFemur, MheightHumor, FheightFemur, FheightHumor;
//-----------------------------------this takes in my heights
scanf("%f, %f", &femur,&humerus);
//-------------------this is where I do my calculations
FheightFemur = femur * 1.94 + 28.7;
MheightFemur = femur * 1.88 +32;
FheightHumor = humerus * 2.8 + 28.2;
MheightHumor = humerus * 2.9 + 27.9;
//-------------------------this will print out my ranges
printf("Based on femur length this is either a %.2f inch female or a %.2f inch male\n", FheightFemur,MheightFemur);
printf("Based on humerus length this is either a %.2f inch female or a %.2f inch male", FheightHumor,MheightHumor);
return 0;
}
//-------------------------------This converts inches input to foot output-----------------------------------------
#include<stdio.h>
#include<math.h>
int main()
{
float femur, humerus, MheightFemur, MheightHumor, FheightFemur, FheightHumor;
//-----------------------------------this takes in my heights
scanf("%f, %f", &femur,&humerus);
//-------------------this is where I do my calculations
FheightFemur = femur * 1.94 + 28.7;
FheightFemur = FheightFemur /12;
MheightFemur = femur * 1.88 +32;
MheightFemur = MheightFemur / 12;
FheightHumor = humerus * 2.8 + 28.2;
FheightHumor = FheightHumor / 12;
MheightHumor = humerus * 2.9 + 27.9;
MheightHumor = MheightHumor / 12;
//-------------------------this will print out my ranges
printf("Based on femur length this is either a %.2f foot female or a %.2f foot male\n", FheightFemur,MheightFemur);
printf("Based on humerus length this is either a %.2f foot female or a %.2f foot male", FheightHumor,MheightHumor);
return 0;
}
//-------------------------------This takes in feet and outputs feet-------------------------------------------------
#include<stdio.h>
#include<math.h>
int main()
{
float femur, humerus, MheightFemur, MheightHumor, FheightFemur, FheightHumor;
//-----------------------------------this takes in my heights
printf("input the size of the femur and then humerous, in feet please\n");
scanf("%f, %f", &femur,&humerus);
//-------------------this is where I do my calculations
femur = femur * 12;
humerus = humerus * 12;
FheightFemur = femur * 1.94 + 28.7;
FheightFemur = FheightFemur /12;
MheightFemur = femur * 1.88 +32;
MheightFemur = MheightFemur / 12;
FheightHumor = humerus * 2.8 + 28.2;
FheightHumor = FheightHumor / 12;
MheightHumor = humerus * 2.9 + 27.9;
MheightHumor = MheightHumor / 12;
//-------------------------this will print out my ranges
printf("Based on femur length this is either a %.2f foot female or a %.2f foot male\n", FheightFemur,MheightFemur);
printf("Based on humerus length this is either a %.2f foot female or a %.2f foot male", FheightHumor,MheightHumor);
return 0;
}
//-----------------------------------------------This gives out both feet and inches ----------------
#include<stdio.h>
#include<math.h>
int main()
{
float femur, humerus, MaleFemurInches, MaleHumerInches, FemaleFemurInches, FemaleHumerInches, MaleFemurFeet, FemaleFemurFeet, MaleHumerFeet, FemaleHumerFeet;
//-----------------------------------this takes in my heights
printf("input the size of the femur and then humerous, in inches please\n");
scanf("%f, %f", &femur,&humerus);
//---------------------------------this is where I do my calculations
FemaleFemurInches = femur * 1.94 + 28.7;
MaleFemurInches = femur * 1.88 +32;
FemaleHumerInches = humerus * 2.8 + 28.2;
MaleHumerInches = humerus * 2.9 + 27.9;
//--------------------------------------------This is where I assign feet and inches variables
MaleFemurFeet = MaleFemurInches / 12;
FemaleFemurFeet = FemaleFemurInches / 12;
MaleHumerFeet = MaleHumerInches / 12;
FemaleHumerFeet = FemaleHumerInches / 12;
//-------------------------------this will print out my ranges
printf("First, female heights by femur legth. \nYou're looking at %.1f feet or %.1f inches tall.\n",FemaleFemurFeet, FemaleFemurInches);
printf("Next, male heights by femur legth.\nThis is %.1f feet or %.1f inches tall.\n",MaleFemurFeet, MaleFemurInches);
printf("Humerus time! \nThis is could be a female of %.1f feet or %.1f inches", FemaleHumerFeet, FemaleHumerInches);
printf("\nThis is possibly a male of %.1f feet or %.1f inches", MaleHumerFeet, MaleHumerInches);
return 0;
}
//-----------------------------------------------This program takes in cm and gives out cm values---------------
#include<stdio.h>
#include<math.h>
int main()
{
float femur, humerus, MheightFemur, MheightHumor, FheightFemur, FheightHumor;
//-----------------------------------this takes in my heights
printf("please enter the femur and humerus length in centimeters, if you would.\n");
scanf("%f, %f", &femur,&humerus);
//----------------------------------I convert from centimeters to inches
femur = femur / 2.54;
humerus = humerus / 2.54;
//-------------------this is where I do my calculations
FheightFemur = femur * 1.94 + 28.7;
MheightFemur = femur * 1.88 +32;
FheightHumor = humerus * 2.8 + 28.2;
MheightHumor = humerus * 2.9 + 27.9;
//-----------------------------------------------I convert back to centimeters
FheightFemur = FheightFemur * 2.54;
MheightFemur = MheightFemur * 2.54;
FheightHumor = FheightHumor * 2.54;
MheightHumor = MheightHumor * 2.54;
//-------------------------this will print out my ranges
printf("Based on femur length this is either a %.2f centimeter female or a %.2f centimeter male\n", FheightFemur,MheightFemur);
printf("Based on humerus length this is either a %.2f centimeter female or a %.2f centimeters male", FheightHumor,MheightHumor);
return 0;
}
//--------------------------------------This program calculated molecular weights
#include<stdio.h>
#include<math.h>
//---------------------------------I defined my atomic weights
#define oxygen 15.9994
#define carbon 12.011
#define nitrogen 14.00674
#define suler 32.066
#define hydrogen 1.00794
int main()
{
//----------------------------------------I add my atomic weights
float glycine, glutamic, glutamine;
glycine = 2*oxygen + 2*carbon + nitrogen + 5*nitrogen;
glutamic = 4*oxygen + carbon*5 + nitrogen + hydrogen*8;
glutamine = oxygen*3 + carbon*5 + nitrogen*2 + hydrogen*10;
//--------------------------------------------------I print out the weights
printf("glycine has a moleculare weight of %9.7f \n", glycine);
printf("Glutamic has a molecular weight of %9.7f \n", glutamic);
printf("glutamine has a molecular weight of %9.7f \n", glutamine);
return 0;
}