Programs for Mrs. Rountree!

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
Yikarso
ES Graphics Artist
ES Graphics Artist
Posts: 130
Joined: Wed Feb 02, 2005 8:38 am
Location: GA

Programs for Mrs. Rountree!

Post 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 :/
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

How about you PM yourself next time?
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
skywalker541
Chaos Rift Regular
Chaos Rift Regular
Posts: 137
Joined: Thu Sep 01, 2005 9:12 pm

Post 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);
}
Last edited by skywalker541 on Tue Oct 18, 2005 11:32 pm, edited 3 times in total.
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

uhh.. yeah. Either learn how to use [ code ] or PM yourself. Do you know how ugly that looks?
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
spideyspiderman2000
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1177
Joined: Fri Sep 17, 2004 9:28 pm
Location: Stupid Kansas
Contact:

Post by spideyspiderman2000 »

JSL, if it annoys you so much, edit it. You're a fucking admin.
South Park wrote:Mr Garrison: Okay class. Can anybody tell me what "Sexual Harrassment" is?

Cartman: Isn't that when you're having intercourse with a special lady friend, and some other guy comes up behind you and tickles your balls?
I HATE Jack Thompson!
skywalker541
Chaos Rift Regular
Chaos Rift Regular
Posts: 137
Joined: Thu Sep 01, 2005 9:12 pm

Post 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.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

From now on, use the code tag. That's why it's here.

[ code ] TEH SORCE COEDS HERE!?!?~! [ / code ]
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post 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.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
Don Pwnious
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 833
Joined: Tue Jun 15, 2004 5:32 pm
Location: on the streets wit my j23
Contact:

Post by Don Pwnious »

JS Lemming wrote: The forum maid?
Yes you do......... j/k
1/8th time- 14secs
1/8th speed - 110mph
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Post 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.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

They both could use some obvious work...

Shame on you guys, and we are supposed to make a game here... :nono:
frozenfury
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 1
Joined: Wed Oct 19, 2005 4:26 pm

Post 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.
Post Reply