Page 1 of 1

Programs for Mrs. Rountree!

Posted: Mon Oct 17, 2005 6:46 am
by Yikarso
/*
#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 :/

Posted: Mon Oct 17, 2005 7:30 am
by JS Lemming
How about you PM yourself next time?

Posted: Tue Oct 18, 2005 11:19 am
by skywalker541

Code: Select all

#include <stdio.h>
#include <iostream.h>
#include <stdlib.h>


struct seat{
    int idnum;
    bool avail;
    avail = true;
    char sname[20];
    strcpy("available",sname);
}

struct plane{
    struct seat seats[12];
}



void printav(struct plane mini);
void printlav(struct plane mini);
void printals(struct plane mini);
void assigncus(struct plane mini);
//void deleteas(struct plane mini);


int main (void){
    struct plane mini;
    char ch;
    while(ch!='f'){
        here: printf("To choose a function, enter its letter label:\na) Show number of empty seats\nb) Show list of empty seats\nc) Show alphabetical ist of seats\nd)Assign a customer to a seat assignment\ne)Delete a seat assignment\nf) Quit");
        if(getchar(ch)=='a')
            printav();
        else if(getchar(ch)=='b')
            printlav();
        else if(getchar(ch)=='c')
            printals();
        else if(getchar(ch)=='d')
            assigncus();
        //else if(getchar(ch)=='e')
            //deleteas();
        else printf("Error,Error Please enter a correct choice");

    }


void printav(struct plane mini){
     int i;
     int count;
     while(i<12){
                 if(mini.seats[i].avail == true)
                 count++;
                 i++:
     }     
     printf("%d available seats",count);
}

void printlav(struct plane mini){
    int i;
    int count;
    while(i<12){
        if(mini.seats[i].avail == true){
        printf("seat number %d is available",count);
        i++;}
}
}

void printals(struct plane mini){
    char temp[30];
    int l;  
    int h;
    for(l=0;l<11;l++)
        for(h=l++;h<12;h++)
            if((strcmp(mini.seats[l].lname,mini.seats[h].lname))>0){
                strcpy(temp,mini.seats[l].sname);
                strcpy(mini.seats[h].sname,mini.seats[l].sname);
                strcpy(mini.seats[h].sname,temp);
    }
    while(i<12){
        printf("%s",mini.seats[i].fname);
        printf(" %s",mini.seats[i].lname);
        i++;
    }
}

void assigncus(struct plane mini){
    int i=0;
    while(i<12){
        if(mini.seats[i].avail == true) break;
        i++;
        else printf("Sorry no available seats")
        break;
    }
    printf("Please enter your first name");
    scanf("%s",&mini.seats[i].fname);
    printf("Please enter your last name");
    scanf("%s",&mini.seats[i].lname);
    mini.seats[i].avail = false;
    printf("Please enter an identification number");
    scanf("%d",&mini.seats[i].idnum);
}

Posted: Tue Oct 18, 2005 3:59 pm
by JS Lemming
uhh.. yeah. Either learn how to use [ code ] or PM yourself. Do you know how ugly that looks?

Posted: Tue Oct 18, 2005 7:27 pm
by spideyspiderman2000
JSL, if it annoys you so much, edit it. You're a fucking admin.

Posted: Tue Oct 18, 2005 9:02 pm
by skywalker541
yeah lol, that does look pretty bad, most of the formatting was lost when i pasted it on here, when i'm done with a program it definetely looks no where near that ugly. wow after looking at that closer, thats not even close to being able to compile, that looks liek absolute crap, wow i should think about deleting that.

Posted: Tue Oct 18, 2005 9:52 pm
by Falco Girgis
From now on, use the code tag. That's why it's here.

[ code ] TEH SORCE COEDS HERE!?!?~! [ / code ]

Posted: Wed Oct 19, 2005 7:36 am
by JS Lemming
spideyspiderman2000 wrote:JSL, if it annoys you so much, edit it. You're a -KAZAAM!-ing admin.
What do I like look like? The forum maid? The chill'n can take care of their own crap or die trying.

Posted: Wed Oct 19, 2005 8:08 am
by Don Pwnious
JS Lemming wrote: The forum maid?
Yes you do......... j/k

Posted: Wed Oct 19, 2005 12:57 pm
by MarauderIIC
Well, if they post it here and someone gets bored and looks at it, they can fix up the code, so I don't mind source being posted here, myself.

Posted: Wed Oct 19, 2005 3:48 pm
by Falco Girgis
They both could use some obvious work...

Shame on you guys, and we are supposed to make a game here... :nono:

Posted: Wed Oct 19, 2005 4:31 pm
by frozenfury
Just use a thumb drive, or email the code to yourself with the ferrari laptops.

Oh, and btw, it's the java student not really in your supercomputing class.