Tuesday, May 07, 2024
05:45 AM (GMT +5)

Go Back   CSS Forums > CSS Optional subjects > Group I > Computer Science

Reply Share Thread: Submit Thread to Facebook Facebook     Submit Thread to Twitter Twitter     Submit Thread to Google+ Google+    
 
LinkBack Thread Tools Search this Thread
  #1  
Old Sunday, October 31, 2010
touqeer2010's Avatar
Senior Member
 
Join Date: Sep 2010
Location: Sukkur
Posts: 339
Thanks: 26
Thanked 120 Times in 98 Posts
touqeer2010 will become famous soon enough
Smile Questions & Answer with Explanation

Simple question for uderstanding the concepts..

Q1:

Main is Udf or Pre define Function ??

Q2:

float a=0.7;
if(a==0.7)
cout<<"Hello " ;
else
cout<<"Bye";

whats the output ?
__________________
Believe me, the reward is not so great without the struggle.
Reply With Quote
  #2  
Old Monday, November 01, 2010
Janas's Avatar
Senior Member
 
Join Date: May 2009
Location: North Pole
Posts: 110
Thanks: 21
Thanked 56 Times in 44 Posts
Janas is on a distinguished road
Default

Quote:
Originally Posted by touqeer2010 View Post
Simple question for uderstanding the concepts..

Q1:

Main is Udf or Pre define Function ??

Q2:

float a=0.7;
if(a==0.7)
cout<<"Hello " ;
else
cout<<"Bye";

whats the output ?
1. Pre-defined Function
2. Hello
Reply With Quote
  #3  
Old Tuesday, November 02, 2010
touqeer2010's Avatar
Senior Member
 
Join Date: Sep 2010
Location: Sukkur
Posts: 339
Thanks: 26
Thanked 120 Times in 98 Posts
touqeer2010 will become famous soon enough
Default

Quote:
Originally Posted by Janas View Post
1. Pre-defined Function
2. Hello
ahan ..

1 . If it is Pre-define .. then why programmer write body of main ??

2. did u tried it on compiler?? try it u will get correct answer :P
__________________
Believe me, the reward is not so great without the struggle.
Reply With Quote
  #4  
Old Thursday, November 04, 2010
Janas's Avatar
Senior Member
 
Join Date: May 2009
Location: North Pole
Posts: 110
Thanks: 21
Thanked 56 Times in 44 Posts
Janas is on a distinguished road
Default

sorry mate,

i dont have a compiler....but ll install and check it.

i ll install eclipse CDT.


but good questions

How far have you prepared for CS yet?
Reply With Quote
  #5  
Old Thursday, November 04, 2010
touqeer2010's Avatar
Senior Member
 
Join Date: Sep 2010
Location: Sukkur
Posts: 339
Thanks: 26
Thanked 120 Times in 98 Posts
touqeer2010 will become famous soon enough
Default

Quote:
Originally Posted by Janas View Post
sorry mate,

i dont have a compiler....but ll install and check it.

i ll install eclipse CDT.


but good questions

How far have you prepared for CS yet?
i m not tring to attempt CSS because My English is not at that Level .. I've Done BSCS ..
__________________
Believe me, the reward is not so great without the struggle.
Reply With Quote
  #6  
Old Thursday, November 04, 2010
Member
 
Join Date: Oct 2010
Location: Islamabad
Posts: 34
Thanks: 11
Thanked 7 Times in 6 Posts
Kayani29 is on a distinguished road
Default

because for floating point numbers 0.7 does not really means 0.7 but it is 0.699999999 so it happens and if u want to make ur code work then write it like this

if (a==0.7f) //Note 'f'
Reply With Quote
  #7  
Old Monday, November 08, 2010
touqeer2010's Avatar
Senior Member
 
Join Date: Sep 2010
Location: Sukkur
Posts: 339
Thanks: 26
Thanked 120 Times in 98 Posts
touqeer2010 will become famous soon enough
Default

Quote:
Originally Posted by Kayani29 View Post
because for floating point numbers 0.7 does not really means 0.7 but it is 0.699999999 so it happens and if u want to make ur code work then write it like this

if (a==0.7f) //Note 'f'
dont agree with ur explanation but ...

Float != Double ..

that is the right explanation .. 0.7 is treated as Double by ur compiler so.. everthing is fine ..
__________________
Believe me, the reward is not so great without the struggle.
Reply With Quote
Reply


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 On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sentence reman_bari1455 English (Precis & Composition) 1 Tuesday, July 29, 2014 02:21 PM
Post of AD(ISI) 2010: Preparation of MCQs Paper redmax Inter Services Intelligence (ISI) 23 Saturday, November 03, 2012 12:06 PM
Gen. Knowledge MCQs Rana G General Knowledge, Quizzes, IQ Tests 5 Friday, May 22, 2009 10:38 PM


CSS Forum on Facebook Follow CSS Forum on Twitter

Disclaimer: All messages made available as part of this discussion group (including any bulletin boards and chat rooms) and any opinions, advice, statements or other information contained in any messages posted or transmitted by any third party are the responsibility of the author of that message and not of CSSForum.com.pk (unless CSSForum.com.pk is specifically identified as the author of the message). The fact that a particular message is posted on or transmitted using this web site does not mean that CSSForum has endorsed that message in any way or verified the accuracy, completeness or usefulness of any message. We encourage visitors to the forum to report any objectionable message in site feedback. This forum is not monitored 24/7.

Sponsors: ArgusVision   vBulletin, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.