Go Back   Computer Forums > Welcome To Computer Forums .org > Social Lounge | Off Topic
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 03-25-2008, 10:21 PM   #1
Golden Master
 
Thelis's Avatar
 
Join Date: Mar 2007
Posts: 5,410
Send a message via AIM to Thelis Send a message via MSN to Thelis Send a message via Yahoo to Thelis
Default Anyone know how to...

Using C, find the minimum and maximum numbers in a list using a while loop?
__________________

Thelis is offline   Reply With Quote
Old 03-25-2008, 10:24 PM   #2
Fully Optimized
 
ace777's Avatar
 
Join Date: Nov 2006
Posts: 3,110
Default Re: Anyone know how to...

are you usind variables? man
__________________

__________________
2.4 Ghz celeron, 1.25 PNY pc 2700 RAM,PNY VERTIGO 5200 FX , 40 GB HDD
900Mhz 256 RAM , MX 4000, 30 GB HDD
1.9Ghz dual core AMD Athlon 2 GB 384 VRAM 320 Gb HD
2.3 tricore phenom,2 GB RAM , EVGA 9600 GSO,250 GB SSD
2.6 X4 620, 4GB RAM, 9600 GSO, 500 GB HDD/I'm part of The Project
ace777 is offline   Reply With Quote
Old 03-25-2008, 10:25 PM   #3
Golden Master
 
Thelis's Avatar
 
Join Date: Mar 2007
Posts: 5,410
Send a message via AIM to Thelis Send a message via MSN to Thelis Send a message via Yahoo to Thelis
Default Re: Anyone know how to...

int n;

I can add more too.
Thelis is offline   Reply With Quote
Old 03-25-2008, 10:29 PM   #4
Fully Optimized
 
ace777's Avatar
 
Join Date: Nov 2006
Posts: 3,110
Default Re: Anyone know how to...

thats c++ i work fluently with basic just now learning c++ sorry man
__________________
2.4 Ghz celeron, 1.25 PNY pc 2700 RAM,PNY VERTIGO 5200 FX , 40 GB HDD
900Mhz 256 RAM , MX 4000, 30 GB HDD
1.9Ghz dual core AMD Athlon 2 GB 384 VRAM 320 Gb HD
2.3 tricore phenom,2 GB RAM , EVGA 9600 GSO,250 GB SSD
2.6 X4 620, 4GB RAM, 9600 GSO, 500 GB HDD/I'm part of The Project
ace777 is offline   Reply With Quote
Old 03-25-2008, 10:34 PM   #5
Golden Master
 
Thelis's Avatar
 
Join Date: Mar 2007
Posts: 5,410
Send a message via AIM to Thelis Send a message via MSN to Thelis Send a message via Yahoo to Thelis
Default Re: Anyone know how to...

No... that is basic C.
Thelis is offline   Reply With Quote
Old 03-25-2008, 10:37 PM   #6
Fully Optimized
 
ace777's Avatar
 
Join Date: Nov 2006
Posts: 3,110
Default Re: Anyone know how to...

I use dark basic which is supposed to be c so i guess its not sorry i can't help you.
__________________
2.4 Ghz celeron, 1.25 PNY pc 2700 RAM,PNY VERTIGO 5200 FX , 40 GB HDD
900Mhz 256 RAM , MX 4000, 30 GB HDD
1.9Ghz dual core AMD Athlon 2 GB 384 VRAM 320 Gb HD
2.3 tricore phenom,2 GB RAM , EVGA 9600 GSO,250 GB SSD
2.6 X4 620, 4GB RAM, 9600 GSO, 500 GB HDD/I'm part of The Project
ace777 is offline   Reply With Quote
Old 03-27-2008, 09:32 AM   #7
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,004
Default Re: Anyone know how to...

I can't think of the actual code off the top of my head, but the logic for it will be like this

x=0;
for (listentry=0, listenrty<=siezeof(list), listentry++)
{
if (listentry>=x)
{
x=listentry;
}
}
printf("largest value in list is %f", x);

to do this in a while loop you'll have to use

while (listentry!=EOF)
{
if (listentry>=x)
{
x=listentry;
}
}
printf("largest value in list is %f", x);


(I suggest using a float rather than an int so that you can use decimals as well in your lists)
__________________

__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 04:51 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0