freelanceprogrammers.org Forum Index » C

C problem

View user's profile Post To page top
krishna_sicsr Posted: Thu Sep 23, 2004 3:43 pm


Joined: 01 Feb 2005

Posts: 2
C problem
why output differs in both statements
-----------------statement 1-----------------------------------
int x;
int y=x++ + ++x +x-- + --x;
output=12
------------------statement 2----------------------------------
int x;
int y;
y=x++ + ++x +x-- + --x;
output=8
---------------------------------------------------------------
Reply with quote
Send private message
View user's profile Post To page top
vinay_sheel2k Posted: Mon Sep 27, 2004 12:39 pm


Joined: 28 Dec 2004

Posts: 2
C problem
Hi,
First of all x(in first case) and x,y(in second case)
should be initialized to some value otherwise result
will be undefined.

look at this code (where I did some small
modification)
*****************************************

int main(int argc, char* argv[])
{
int x = 0;
int y=x++ + ++x +x-- + --x;
/* int x = 0;
int y = 0;
y=x++ + ++x +x-- + --x; */


printf("%d %d
",y,x);
return 0;
}

****************************End***********

In both cases (comment and uncomment out required test
cases) output is
3,0

regds
vinay


--- krishna_sicsr <krishna_sicsr@...> wrote:

> why output differs in both statements
> -----------------statement
> 1-----------------------------------
> int x;
> int y=x++ + ++x +x-- + --x;
> output=12
> ------------------statement
> 2----------------------------------
> int x;
> int y;
> y=x++ + ++x +x-- + --x;
> output=8
>
---------------------------------------------------------------
>
>
>
>




__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo
Reply with quote
Send private message
View user's profile Post To page top
zimbabao Posted: Tue Sep 28, 2004 7:28 pm


Joined: 26 Jul 2003

Posts: 4
C problem
> why output differs in both statements
> -----------------statement 1-----------------------------------
> int x;
> int y=x++ + ++x +x-- + --x;
> output=12
> ------------------statement 2----------------------------------
> int x;
> int y;
> y=x++ + ++x +x-- + --x;
> output=8
> ---------------------------------------------------------------

the staements above results into undefined results

plz go thru following link and all the question to undwerstand it better

http://www.eskimo.com/~scs/C-faq/s3.html

hope that helps

-- rajaram
Reply with quote
Send private message
View user's profile Post To page top
jqgoh Posted: Wed Feb 02, 2005 9:00 pm


Joined: 02 Feb 2005

Posts: 1
C problem
Hi,i`m a college student.Do u all know how to changed the font and
color of the character?
Reply with quote
Send private message
View user's profile Post To page top
sflam108 Posted: Thu Feb 03, 2005 10:22 pm


Joined: 25 Jul 2003

Posts: 48
C problem
Hi,

> -----Original Message-----
> From: JQ [mailto:jqgoh@...]
> Sent: Wednesday, February 02, 2005 9:01 AM
> To: Programmers-Town@yahoogroups.com
> Subject: (PT) C problem
>
> Hi,i`m a college student.Do u all know how to changed the font and
> color of the character?

I might, but it is possible that you are not using the same platform as I
do.

You have to give us more info. What are your:
- Target platform,
- Development tools and version,
- Type of application,

Shyan
Reply with quote
Send private message
View user's profile Post To page top
ashwin_mittal26 Posted: Fri Feb 04, 2005 12:26 am


Joined: 27 Dec 2004

Posts: 14
C problem
--- Shyan Lam <sflam@...> wrote:

> Hi,
>
> > -----Original Message-----
> > From: JQ [mailto:jqgoh@...]
> > Sent: Wednesday, February 02, 2005 9:01 AM
> > To: Programmers-Town@yahoogroups.com
> > Subject: (PT) C problem
> >
> > Hi,i`m a college student.Do u all know how to
> changed the font and
> > color of the character?
>
> I might, but it is possible that you are not using
> the same platform as I
> do.
>
> You have to give us more info. What are your:
> - Target platform,
> - Development tools and version,
> - Type of application,
>
> Shyan
>

If you are using Turbo/Borland C++ compiler...

then you have to include graphics.h header file...

there are total five fonts available in Turboc
Compiler.

Adn the function for chosing font is settextstyle...
Similarly you can change the colour of your font...


Regards,
Ashwin Mittal.



__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail
Reply with quote
Send private message
View user's profile Post To page top
cool_alok Posted: Sat Feb 05, 2005 5:22 pm


Joined: 05 Feb 2005

Posts: 5
C problem
IN what Plateform
 --> IN Dos Based
   look for function defined in Graphics.h SetTextFont etc.
 
  -->in Win Api
any way if it MFC you can use CFont and it member function i.e. (CreateFont) to create your own font.or you can directly use Win32Api function CreateFont to create your own font and set in the static Ctrl.here is small code listing for your problemCFont fnt;fnt.CreateFont(12,0,0,0,FW_BOLD,FALSE,FALSE,FALSE, DEFAULT_CHARSET,OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, DEFAULT_PITCH ,"Arial");//now set the font of your controlm_TextWindow.SetFont(&fnt);

-- --- Original Message -----
From: JQ
To: Programmers-Town@yahoogroups.com
Sent: Wednesday, February 02, 2005 8:30 PM
Subject: (PT) C problem
Hi,i`m a college student.Do u all know how to changed the font and color of the character? To unsubscribe : programmers-town-unsubscribe@yahoogroups.com
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help