[Show all top banners]

Robert Frost
Replies to this thread:

More by Robert Frost
What people are reading
Subscribers
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 C Program help

[Please view other pages to see the rest of the postings. Total posts: 38]
PAGE: <<  1 2  
[VIEWED 5491 TIMES]
SAVE! for ease of future access.
The postings in this thread span 2 pages, go to PAGE 1.

This page is only showing last 20 replies
Posted on 10-17-04 5:09 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Hi all!
Anybody done a C Program for "guessing a secret number"?
 
The postings in this thread span 2 pages, go to PAGE 1.

This page is only showing last 20 replies
Posted on 10-18-04 1:20 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

The program in action. Case 1:

 
Posted on 10-18-04 1:23 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 
 
Posted on 10-18-04 1:36 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

C= Crack
C= Chor
C= Chow Chow what else you want to know
 
Posted on 10-18-04 1:42 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

hey deepak bro?oops i mean echoes..;oP(saw the name on ur print screen)
wahahaha....

yo solutution dhekhera robert lai ta lecturer le pheri C master thanla hai hehehe ;oP
dyam i should post me assignements here too ;oP....

anyways nice to see the masters still takin time to help :o)....
just came to ask..do u have VB.NET notes?good ones hehe...with examples of coding....

la ta came to ask that..gotta go back to me stuffs...urghhh...

goodmorn..:o)

danny
 
Posted on 10-18-04 1:52 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Echoes bruuu

Aaaanch!! Guru is here... hehe...
Bruuu, I gotta cut and paste above code for a future reference... hehe....
Wednesday I'm gonna post a project :P Deepak bru, are you up for it?? hehe.. don't worry, I have 20 days after this wednesday to submit it....

LOL.
 
Posted on 10-18-04 6:05 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Echoes,
I owe you one for that!!!

I am thinking of a nice spanish cuisine or the finest of its cigar and champagne..!! Whaddya Sir?? :)
 
Posted on 10-19-04 5:45 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Frosty,
I think you better stick with coding poems.. :P

Echoes, that's very good solution... really impressive
 
Posted on 10-19-04 7:39 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Danny---haha. Well, lets hope that Bob doesn't turn in the screenshot jpegs, instead of the source and an executable! Just kidding.

Umm...I do C# (not VB.NET) with .NET. But the paradigm is the same. So what's your question? You might want to check out the Microsoft Developer Netowrk (MSDN) www.msdn.microsoft.com, as well.

Problems that are fun and won't take hours to solve are welcome.

Kalanki---Sure, bro! Be warned though, it could be only to find out on the 20th day that it's still you who's going to have to do it!

Robert---Sounds good. We'll have a toast after you've made it through the rest of the semester. Good luck to you.

Rusty bru---ehehe. Well, looked like the kids were in trouble, so. But I feel good to have been complimented by a guru. Appreciated.

Good day!
 
Posted on 10-19-04 10:34 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Dear Rusty,
How nice to hear from you....!!

Why don't you start coding poems yourself, sunshine..!!!
will join ya!! the pleasure will always be mine,
as for now, I gotta take my time,
to solve this pennies, nickels and dimes..!!!!!!!!!!!!!

Echoes, Kalanki, Danny, and our Sajha programmers,

help me please.!!
Rewrite the program with functions to perform insert and remove operations. The function insert (int p, int n, int d, int q) will initialize pennies, nickels, dimes and quarters. The function dollars() will return the dollars. The function remove (int p, int n, int d, int q) will subtract pennies, nickels, dimes and quarters. The function display() returns a new String to print the content of the purse with remaining pennies, nickels, dimes and quarters. Make sure your program is working correctly.

NB: I figure out not too long ago, that I am horrible in programming...!!!! :) I mean! I can do math problems, probably anything that makes sense and logics, but this programming, na!! man..!!


 
Posted on 10-19-04 10:36 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Ok my question !!

Has anyone made simplest of web browsers using JAVA? No features...just u give url and it runs!!

I have to get that done in about a week and as usual very occupied with other subjects....anyone wanna give me some tips?
 
Posted on 10-19-04 10:40 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

"NB: I figure out not too long ago, that I am horrible in programming...!!!! :) I mean! I can do math problems, probably anything that makes sense and logics, but this programming, na!! man..!! "----RFrost

-- I agree With you 100%. I have always been in Maths as well..I mean..I enjoy maths..but the hatest thing about programming is the errors it generates...and I dont have patience NOR do I LOVE programming lol.....I guess people who are really good in programming really LOVE what they are doing..I mean I have seen some people ..who enjoy being challenged with these kid of stuffs...amazing!!.
 
Posted on 10-19-04 2:17 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

danny bro, i might have one of VB tutorial...hey echoes bro k cha??

kalanki bro, dammn programmer..:p
 
Posted on 10-19-04 2:17 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

do you need them danny bro??


 
Posted on 10-19-04 2:44 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

oi confused mula...are u that confused?:oP u gone over me expectations of u ;oP

abo testo things pani sodney ho?hehe ....just mail it ke ;o)..abo gmail ke ko kaam?hehe..
look at those spammers....hyaaa esto bombard garda darda...urghhh....

anyways thanks ..esp oif it helps..i will treat u a cup of chia..if i ever get the chance la :o)..
will find u in sajha now..since u might be there hehe...easier to pass it there hoina?trying to make it easier..hehe
btw oi post ur desktop and make it less u know...make it more good for the eyes to see...wanna see if there is anything more useful u have for me ..turns out u r a useful bugger ;oP....hehe

okkk good morn from here...cya in sajha..if u are there...

echoes bro....hehe..i think robert will submit his poetry instead and impress the lecturer hehehe...and thanks for the site...gonna look at it when im in uni..cant do at home..need the bloody server...and C# hehe i think me frens needs ur help?when are u free?wanna setup a meeting with them?;oP...

robert u like maths?urghh it kills me these days..:oS too long away from it :oS....programmin ta maths ni ho...freakn logics and syntax..its fun when it works..but if it doest..dyam!hehehe.....programming is practice too...if u love maths u will love it...dun u like to solve problems?hehe..mapani programming mah kharaab..:oS...dyam this reminds me..have to do me programming assing due last week!!arghhh!! good luck on urs...u better try to do it urself..and get some help hehe..unless if too urgent than let others do it fully for u hehe..cos well...we can 'lie' our way for a long time...but in the truth will be out...im sure u can do it..just try a bit harder..cos most prob...tho u think u tried hard enuf..maybe u aint?hehe :o)..ok enuf of lectures...im not that old..and that applies to me too...dyam i need to do me work!..have fun....programming..:o)

laters


danny
 
Posted on 10-24-04 2:03 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Anybody please..I am still waiting on my program above...!
 
Posted on 10-27-04 9:34 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Why is nobody listening to me????

SAJHA DEBUGGERS HELP WANTED>>>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Here is the program and below I have listed the errors that I am not being able to fix...I need your help, just asked for the Prof. for more time on this project..so please help me..

#include

int pennies, nickels, dimes, quarters;

int main()
{
char y;
int p,n,d,q;

pennies=0;
nickels=0;
dimes=0;
quarters=0;


display(pennies,nickels,dimes,quarters);

do {
printf("Select an action:: (I/R/D/Q) \n");
printf("I = Insert, R = Remove, D = Display, Q = Quit");
scanf("%c", &y);

if y = "I"
{
printf("Insert..");
scanf("%d%d%d%d", &p, &n, &d, &q);
insert(p,n,d,q);
display(pennies,nickels,dimes,quarters);
}
else if y = "R"
{
printf("Remove..");
scanf("%d%d%d%d", &p, &n, &d, &q);
rem(p,n,d,q);
display(pennies,nickels,dimes,quarters);
}
else if y = "D"
{
display(pennies,nickels,dimes,quarters);
}

while(y != "Q");

{
printf("Program terminated...");
}
}
//Function that inserts money in the purse
int insert(int p, int n, int d, int q)
{
pennies += p;
nickels += n;
dimes += d;
quarters += q;

}


//Function that displays the contents of the purse
int display(int pnys, int nkls,int dimes, int qrts)
{
float x = pnys + 5*nkls + 10*dimes + 25*qrts;
x = (float)x/100;

printf("Contents of your purse : \n");
printf( " %d quarters + %d dimes + %d nickels + %d pennies = $%d \n", qrts, dimes, nkls, pnys, x);
}


//Function that removes money from the purse
int rem(int p,int n, int d,int q)
{
pennies -= p;
nickels -= n;
dimes -= d;
quarters -= q;
}


Errors that are showing:

pndq.c: In function `main':
pndq.c:23: parse error before "y"
pndq.c:30: parse error before "else"
pndq.c: At top level:
pndq.c:37: parse error before "else"




 
Posted on 10-27-04 10:21 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

RF, you are not comparing the characters in the if-else statement but you are assigning the value to y, which is wrong... you were supposed to compare... and also, put the ifstatement inside the bracket. Won't work if you don't.
Try if(y == 'A'). I think it's supposed to be single quote, not the double quote. forgot.. :P

Same with while loop, I guess, eh...
 
Posted on 10-27-04 10:27 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

and also your scanf("%c", &y); will run into problem coz it's in the while loop.... Works fine for the first loop, after that I am sure it will give you a problem.
Think about this, you asked a user to enter a character... user enters a character... and hits the enterkey... so there is a newline also, which is \n, ie one character... so when the loop runs second time, it will read \n, and won't let a user to enter another character.
There are bunch of ways to avoid this... one is use fflush(stdio); right after scanf.
I think the other way is scanf(" %c", &something); NOTICE the space after " and %.

 
Posted on 10-27-04 6:53 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Robert--

That was a good start. Good job! But start your assignments early, man! (Posting the problem statements on sajha isn't enough!) It'll be very rough to try to get a programming task done in the last minute. And be warned, these are trivial programs... the complexity will grow rapidly as the semester goes on... and it's easy to fall behind. When I used to be a TA, this used to be the single-most reason why many students failed: saving the programming assignments to the night before it's due. Just don't do it! Won't work in computer science.

Well anyways. Sounds like you're in a desperate situation so I just spent an hour or so on it and here's the code. If it's for a school project, then please don't copy it as is. It's just so that you get an idea of how things can be done. As usual, Kalanki also has excellent suggestions for you... Hope it helps:



 
Posted on 10-27-04 6:57 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 


And here's the program in action (read it in its entirety):



 



PAGE: <<  1 2  
Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 30 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration case still pending ..
मन भित्र को पत्रै पत्र!
काेराेना सङ्क्रमणबाट बच्न Immunity बढाउन के के खाने ?How to increase immunity against COVID - 19?
TPS Work Permit/How long your took?
Guess how many vaccines a one year old baby is given
अमेरिकामा बस्ने प्राय जस्तो नेपालीहरु सबै मध्यम बर्गीय अथवा माथि (higher than middle class)
Travelling to Nepal - TPS AP- PASSPORT
Morning dharahara
Another Song Playing In My Mind
Travelling on TPS advance travel document to different country...
Are you ready to know the truth?
Alert: Turbo Cancers: A Rising Global Threat
Does the 180 day auto extension apply for TPS?
ढ्याउ गर्दा दसैँको खसी गनाउच
1974 AD Pinjadako Suga Remixed
Susta Susta Degree Maile REMIXED version
Elderly parents travelling to US (any suggestions besides Special Assistance)?
कल्लाई मुर्ख भन्या ?
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters