GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 03-Sep-2004, 17:36
daNichex6 daNichex6 is offline
New Member
 
Join Date: Sep 2004
Posts: 1
daNichex6 is on a distinguished road

Need help on simple Programming Project


I just got transfered into this class and it seems as though I have an assignment due at 11p.m. tonight I have to email my teacher for make up. I have no idea how to do this because I have not gotten an example or anything. Sorry to post this here but I am just desperate for some help so I don't make a fool out of myself in front of my teacher. This is not meant to be in any special code or anything, just simple solving to build tactics in programming. I am not asking anyone to do this for me, but simply some help on how to do this.. perhaps an example. Thanks.

The Problem:
Write an algorithmic solution to the problem of finding the largest number out of three numbers. List the specific steps that would enable another person to find the largest among three numbers presented. Make sure that you desk-check your solution and verify that it works.
It must include an IPO chart, and assumptions whatever that means...
  #2  
Old 03-Sep-2004, 19:08
nkhambal nkhambal is offline
Regular Member
 
Join Date: Jul 2004
Location: CA USA
Posts: 315
nkhambal is a jewel in the roughnkhambal is a jewel in the rough
Quote:
Originally Posted by daNichex6
I just got transfered into this class and it seems as though I have an assignment due at 11p.m. tonight I have to email my teacher for make up. I have no idea how to do this because I have not gotten an example or anything. Sorry to post this here but I am just desperate for some help so I don't make a fool out of myself in front of my teacher. This is not meant to be in any special code or anything, just simple solving to build tactics in programming. I am not asking anyone to do this for me, but simply some help on how to do this.. perhaps an example. Thanks.

The Problem:
Write an algorithmic solution to the problem of finding the largest number out of three numbers. List the specific steps that would enable another person to find the largest among three numbers presented. Make sure that you desk-check your solution and verify that it works.
It must include an IPO chart, and assumptions whatever that means...


I can give you some clue on how your algorithm should look like

Lets say i have 3 nos a,b & c.

Lets assume a variable "max" that hold the largest no.

now the program should look like

if (a>b) then max=a else max=b
if (max>c) then (print max and exit we have got largest number) else max=c (now C is the lagest among the three.Print c)

if you want C program it looks like this

CPP / C++ / C Code:
#include <stdio.h>

main()
{
char line[100];
int a,b,c,max;       // Variables to hold out 3 nos and largest no

printf("Enter 3 nos seperated by space: ");
fgets(line,sizeof(line),stdin);
sscanf(line,"%d %d %d",&a,&b,&c);


if (a>b)
{ 
  max=a;
} else {
	max=b;
}

if (max>c) 
{
printf("Largest of 3 nos is: %d\n",max);
} else {
printf("Largest of 3 nos is: %d\n",c);
}
}
Hope this helps

Thanks,
 
 

Recent GIDBlogAccepted for Ph.D. program by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] GUI programming with FLTK dsmith FLTK Forum 10 03-Oct-2005 16:41
Beginning C Programming ToyMachine22122 C Programming Language 7 30-May-2004 11:07
Help with project. anignna C Programming Language 12 27-Apr-2004 08:51
Anyone need a PHP project done? geedubya15 New Member Introductions 2 25-Jun-2003 12:29

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 20:46.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.