Programs for Mrs. Rountree!
Posted: Mon Oct 17, 2005 6:46 am
/*
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
float thisyear[12]={3.2,2.1,1.5,4.2,8.5,1.2,.4,2.7,1.2,8.3,3.1,4};
float lastyear[12]={4.1,4.3,3.5,5.6,2.3,4.1,.6,3.8,2.4,5.7,4.5,3};
float avgthis;
float avglast;
float totalthis=0;
float totallast=0;
int x;
printf(" Jan Feb Mar Apr May Jun Jly Aug Sep Oct Nov Dec\n");
printf("This = %.1f ",thisyear[0]);
for(x=1;x<12;x++)
{
printf(" %3.1f ",thisyear[x]);
}
printf("\n");
printf("Last = %.1f ",lastyear[0]);
for(x=1;x<12;x++)
{
printf(" %3.1f ",lastyear[x]);
}
printf("\n\n");
for(x=0;x<12;x++)
{
totalthis+=thisyear[x];
}
for(x=0;x<12;x++)
{
totallast+=lastyear[x];
}
avgthis=totalthis/12.0;
avglast=totallast/12.0;
printf("Total rainfall this year = %.2f\n",totalthis);
printf("Total rainfall last year = %.2f\n",totallast);
printf("Average monthly rainfall for this year = %.2f\n",avgthis);
printf("Average monthly rainfall for last year = %.2f\n\n",avglast);
system("PAUSE");
return 0;
}
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
double panda1[10]={10,4,5,39,321,44,55,23,217,333};
double panda2[15]={33,124,45,6,2,4,633,7,433,1,44,13,321,212,700};
double panda3[15];
int i;
int j;
int temp;
for (i = 0; i < 9; i++)
{
for (j = 0; j < 9-i; j++)
{
if (panda1[j-1] > panda1[j])
{
temp = panda1[j-1];
panda1[j-1] = panda1[j];
panda1[j] = temp;
}
}
}
for (i = 0; i < 14; i++)
{
for (j = 0; j < 14-i; j++)
{
if (panda2[j-1] > panda2[j])
{
temp = panda2[j-1];
panda2[j-1] = panda2[j];
panda2[j] = temp;
}
}
}
for(i = 0;i < 15;i++)
{
if(i>strlen(panda1))
panda3=panda2;
if(i<=strlen(panda1))
panda3=panda1+panda2;
}
for (i = 0; i < 14; i++)
{
for (j = 0; j < 14-i; j++)
{
if (panda3[j-1] > panda3[j])
{
temp = panda3[j-1];
panda3[j-1] = panda3[j];
panda3[j] = temp;
}
}
}
for(i=0;i<15;i++)
printf("%.0lf\n",panda3);
system("PAUSE");
return 0;
}
/*
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int votes[3][2];
printf("Should hackzoring teh mainframe be allowed in PSO?\n\n");
printf("OMGWTFBBQ LEIK NOES ITS ARE TEH BADS!\nMale = ");
scanf("%d",&votes[0][0]);
printf("Female = ");
scanf("%d",&votes[0][1]);
printf("\nDude I just took down Dark Falz in one hit with my Lavis Cannon! (yes)\nMale = ");
scanf("%d",&votes[1][0]);
printf("Female = ");
scanf("%d",&votes[1][1]);
printf("\nNo Opinion\nMale = ");
scanf("%d",&votes[2][0]);
printf("Female = ");
scanf("%d",&votes[2][1]);
printf("\n\nOpinion\t\tMale\tFemale\tTotal\n");
printf("Opposed\t\t%d\t%d\t%d\n",votes[0][0],votes[0][1],votes[0][0]+votes[0][1]);
printf("In favor\t%d\t%d\t%d\n",votes[1][0],votes[1][1],votes[1][0]+votes[1][1]);
printf("No opinion\t%d\t%d\t%d\n",votes[2][0],votes[2][1],votes[2][0]+votes[2][1]);
printf("Totals\t\t%d\t%d\t%d\n\n",votes[0][0]+votes[1][0]+votes[2][0],votes[0][1]+votes[1][1]+votes[2][1],votes[0][0]+votes[1][0]+votes[2][0]+votes[0][1]+votes[1][1]+votes[2][1]);
system("PAUSE");
return 0;
}
*/
/*
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int arr[20];
int subscript;
int highest;
int y;
printf("Enter 20 ints\n");
for(y=0;y<20;y++)
{
scanf("%d",&arr[y]);
}
highest=arr[0];
subscript=0;
for(y=0;y<20;y++)
{
if(arr[y]>highest)
{
highest=arr[y];
subscript=y;
}
}
printf("The highest number in that list, at subscript %d, is %d\n",subscript,highest);
system("PAUSE");
return 0;
}
*/
/*
#include <stdio.h>
#include <stdlib.h>
#define CSIZE 4
struct name
{
char firstname[20];
char second name[20];
};
struct student
{
struct Name;
float grade[3];
float avg;
};
int main(int argc, char *argv[])
{
struct student students[CSIZE];
strcpy(students[0].name, "Brian Peppers");
strcpy(students[1].name, "GyroVorbis");
strcpy(students[2].name, "Yemmie");
strcpy(students[3].name, "Mr. Rogers");
*/
Just posting these here because gmail doesn't work on the lame school computers :/
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
float thisyear[12]={3.2,2.1,1.5,4.2,8.5,1.2,.4,2.7,1.2,8.3,3.1,4};
float lastyear[12]={4.1,4.3,3.5,5.6,2.3,4.1,.6,3.8,2.4,5.7,4.5,3};
float avgthis;
float avglast;
float totalthis=0;
float totallast=0;
int x;
printf(" Jan Feb Mar Apr May Jun Jly Aug Sep Oct Nov Dec\n");
printf("This = %.1f ",thisyear[0]);
for(x=1;x<12;x++)
{
printf(" %3.1f ",thisyear[x]);
}
printf("\n");
printf("Last = %.1f ",lastyear[0]);
for(x=1;x<12;x++)
{
printf(" %3.1f ",lastyear[x]);
}
printf("\n\n");
for(x=0;x<12;x++)
{
totalthis+=thisyear[x];
}
for(x=0;x<12;x++)
{
totallast+=lastyear[x];
}
avgthis=totalthis/12.0;
avglast=totallast/12.0;
printf("Total rainfall this year = %.2f\n",totalthis);
printf("Total rainfall last year = %.2f\n",totallast);
printf("Average monthly rainfall for this year = %.2f\n",avgthis);
printf("Average monthly rainfall for last year = %.2f\n\n",avglast);
system("PAUSE");
return 0;
}
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
double panda1[10]={10,4,5,39,321,44,55,23,217,333};
double panda2[15]={33,124,45,6,2,4,633,7,433,1,44,13,321,212,700};
double panda3[15];
int i;
int j;
int temp;
for (i = 0; i < 9; i++)
{
for (j = 0; j < 9-i; j++)
{
if (panda1[j-1] > panda1[j])
{
temp = panda1[j-1];
panda1[j-1] = panda1[j];
panda1[j] = temp;
}
}
}
for (i = 0; i < 14; i++)
{
for (j = 0; j < 14-i; j++)
{
if (panda2[j-1] > panda2[j])
{
temp = panda2[j-1];
panda2[j-1] = panda2[j];
panda2[j] = temp;
}
}
}
for(i = 0;i < 15;i++)
{
if(i>strlen(panda1))
panda3=panda2;
if(i<=strlen(panda1))
panda3=panda1+panda2;
}
for (i = 0; i < 14; i++)
{
for (j = 0; j < 14-i; j++)
{
if (panda3[j-1] > panda3[j])
{
temp = panda3[j-1];
panda3[j-1] = panda3[j];
panda3[j] = temp;
}
}
}
for(i=0;i<15;i++)
printf("%.0lf\n",panda3);
system("PAUSE");
return 0;
}
/*
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int votes[3][2];
printf("Should hackzoring teh mainframe be allowed in PSO?\n\n");
printf("OMGWTFBBQ LEIK NOES ITS ARE TEH BADS!\nMale = ");
scanf("%d",&votes[0][0]);
printf("Female = ");
scanf("%d",&votes[0][1]);
printf("\nDude I just took down Dark Falz in one hit with my Lavis Cannon! (yes)\nMale = ");
scanf("%d",&votes[1][0]);
printf("Female = ");
scanf("%d",&votes[1][1]);
printf("\nNo Opinion\nMale = ");
scanf("%d",&votes[2][0]);
printf("Female = ");
scanf("%d",&votes[2][1]);
printf("\n\nOpinion\t\tMale\tFemale\tTotal\n");
printf("Opposed\t\t%d\t%d\t%d\n",votes[0][0],votes[0][1],votes[0][0]+votes[0][1]);
printf("In favor\t%d\t%d\t%d\n",votes[1][0],votes[1][1],votes[1][0]+votes[1][1]);
printf("No opinion\t%d\t%d\t%d\n",votes[2][0],votes[2][1],votes[2][0]+votes[2][1]);
printf("Totals\t\t%d\t%d\t%d\n\n",votes[0][0]+votes[1][0]+votes[2][0],votes[0][1]+votes[1][1]+votes[2][1],votes[0][0]+votes[1][0]+votes[2][0]+votes[0][1]+votes[1][1]+votes[2][1]);
system("PAUSE");
return 0;
}
*/
/*
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int arr[20];
int subscript;
int highest;
int y;
printf("Enter 20 ints\n");
for(y=0;y<20;y++)
{
scanf("%d",&arr[y]);
}
highest=arr[0];
subscript=0;
for(y=0;y<20;y++)
{
if(arr[y]>highest)
{
highest=arr[y];
subscript=y;
}
}
printf("The highest number in that list, at subscript %d, is %d\n",subscript,highest);
system("PAUSE");
return 0;
}
*/
/*
#include <stdio.h>
#include <stdlib.h>
#define CSIZE 4
struct name
{
char firstname[20];
char second name[20];
};
struct student
{
struct Name;
float grade[3];
float avg;
};
int main(int argc, char *argv[])
{
struct student students[CSIZE];
strcpy(students[0].name, "Brian Peppers");
strcpy(students[1].name, "GyroVorbis");
strcpy(students[2].name, "Yemmie");
strcpy(students[3].name, "Mr. Rogers");
*/
Just posting these here because gmail doesn't work on the lame school computers :/