Hi guys , in C++ programming (if) when we use "=" isntead of "==" compiler behave the same ... Do u know why compiler behave like this ?? tnx
in the first if condition want to place double equal.then it will treat as condition.otherwise it will treat as declaration
C++ compiler treat Zero(0) as false and all nonzero value as true.
Consider the case 1:
if(val=20) //implicitly it becomes if(20)
{
cout<<"Control comes here.";
}
Case 2:
val=5;
if(val==5) //implicitly it becomes if(1) as condition is true
{
cout<<"here control comes.";
}
Write a function to print sum of the digits in a given integer n without converting it to string. For example : if n = 1234 the function should return 1+2+3+4 = 10 if n = 15 the function should return 1+5 =6 if n = 5 the function should return 5.
"c #include main() { int n, sum = 0, remainder; printf("Enter an integer "); scanf("%d",&n); while(n != 0) { remainder = n % 10; sum = sum + remai...
"c #include #define MIN_REMAINDER 0 /* For checking the number */ int findSum(int); /* recursive function to find the Sum */ main() { int num = 1,sum...
Tell about shell aritmetic operators and functions.
There are following shell operators
Arithmetic Operators.
Relational Operators.
Boolean Operators.
String Operators.
File Test Operators.
What are the attributes of samba?
Here are the samba attributes sambaLMPassword sambaNTPassword sambaPwdLastSet sambaAcctFlags sambaLogonTime sambaLogoffTime sambaKickoffTime sambaPwdCanChange sambaPwdMustChange sambaHomeDrive samb...
Cass to track number of instances
Design a class that will keep track of number of instances that have been instantiated. Make this class thread safe.
here
Code
1 public class Utility 2 { 3 public Utility() 4 { 5 InstanceCount++; 6 } 7 8 public static int InstanceCount; 9 }
How to write spiral matrix program?
Code
#include<stdio.h> main() { int a[20][20],i,j,n,m,p,q,k=0; Enter Order Of matrix"); scanf("%d%d",&m,&n); for(i=1;i<=m;i++) for(j=1;j<=n;j++) scanf("%d",&a[i][j]); p=m; q=n; i=j=1; while(k<p*q) { for(;j<=n&&k<p*q;j++) { k++; } j--; i++; for(;i<=m && k<p*q;i++) { k++; } i--; j--; for(;j>=i-m+1 && k<p*q;j--) { k++; } j++; i--; for(;i>1 && k<p*q;i--) { k++; } if(k<p*q) { j++; i++; n--; m--; } } }
/*~~~~~~~~~ Creates square and rectangular matrices ~~~~~~~~*//* Input required is dim of the spiral matrix. Just feed in two factors of the size of array. i.e If Items are 35 then m = 5 n ...
Why the programing language are case sensitive as is not for user friendly.
Yes th programming language is case sensitive because of its sensitivity that means the language itself having some built in keywords that are used to define variables and data types also vary accordi...
When a PL is case sensitive, the number of possible keywords/ variable names permissible is increased.
Also - more important reason - program readability is improved - we use caps for macros, have different naming conventions based on case sensitivity and so on.
If the interface in c# only contains the declaration of the methods and we need to define those methods in the class, then why we use the interface..???
Interfaces define a contract. You should use it only if you want to support a group or related functionalities in a class or struct. Otherwise there is no need to use it. Think about cars - they have ...
What is command line arguments?What are its uses?Where we have to use this?
Command line arguments are used to provide input through console to the main function. The inputs values generally store into a string array (usually args[])Example:void main (String args[]){for ...
command line arguments are those which can be passed to the main method as parameters and use those values in the main method before executing it.
Explain and differentiate modular programming and structured programming approach?
Programming approachesModular- In this approach we have some code that are implemented thru short of modules. We basically empasize on that modules and that modules are collectively form a program in ...
In a compiler there is 36 bit for a word and to store a character 8bits are needed. In this to store a character two words are appended. Then for storing a k characters string, how many words are neededa. 2k/9b. (2k+8)/9c. (k+8)/9d. 2*(k+8)/9e. None
2k/9= 2*36/9=8 bits are needed for storing a character...
To which segment does static functions belong?
Static functions belongs to the stack segment.
In languages without exception-handling facilities, we could send an error-handling procedure as a parameter to each procedure that can detect errors that must be handled. What disadvantages are there to this method?
When there is a new error to be detected, the source code of the exception handling function must be updated - and seperately compiled. Also we have the over head of sending an additional parameter. T...
ColdFusion Interview Questions
456 sum is 15