a parallel is data structure for representing array of records.
With the string.h header file you can do special string functions such as
----
strcat() Sticks two strings together, one at the end of another.
strncat() Sticks a given amount of characters from two strings together, one at the end of another.
strchr() Returns the location of a character in a string from the beginning.
strrchr() Returns the location of a character in a string from the end.
strcmp() Compares 2 strings and returns the value 0 if both match.
strcasecmp() Compares 2 strings ignoring case and returns the value 0 if both match.
strncasecmp() Compares only a set number of characters in 2 strings ignoring case.
strcpy() Copies one string into another.
strncpy() Copies only a set number of characters from one string to another.
strlen() Returns the length of the string (Except the final NULL character).
The null character is \0 which dignifies the end of a string.
strstr() Locates one string inside of another.
Remember to use these you MUST include the string.h header file by typing #include <string.h>.
Difference between function and recursive variable?
A function can map for sets with infinite elements. Recursive variables, being 'algorithms of algorithms', are restricted to finite elements.
What is flowchart and explain its symbols?
it is diagram which illustrate the flow of goods ,information ,people and transport at a given time and place
What are the merits and demerits of while loop and do while loop in c plus plus?
You use a while() loop when you want to test a condition before entering a loop for the first time, which may bypass the loop completely. The condition is also tested before beginning each iteration.
A do..while() loop always executes the loop at least once, and tests the condition at the end of each iteration before beginning a new iteration.
Algorithm to find whether given string is palidrome?
Let L = length of the string.
greatest integer (L/2) gives the number of pairs of characters that must be compared.
For example if there are 10 letters 10/2 = 5.
abcdeedcba
If there are 11 letters, 11/5= 5.5, also 5. The 6th letter won't matter in this palindrome because it doesn't have to match another character.
abcdefedcba
Once we have the number of pairs [L/2], we need only run a loop,
as 'i' goes from 1 to [L/2]
check that "character i" = "character L+1-i"
C program for linear search using non recursive functiontion?
void main(){
int a[10],i,n,m,c=0;
clrscr();
printf("Enter the size of an array");
scanf("%d",&n);
printf("\nEnter the elements of the array");
for(i=0;i<=n-1;i++){
scanf("%d",&a[i]);
}
printf("\nThe elements of an array are");
for(i=0;i<=n-1;i++){
printf(" %d",a[i]);
}
printf("\nEnter the number to be search");
scanf("%d",&m);
for(i=0;i<=n-1;i++)
{
if(a[i]==m)
{
c=1;
break;
}
}
if(c==0)
printf("\nThe number is not in the list");
else
printf("\nThe number is found");
getch();
}
--------------------------------------------------------------------Write a program to find the average of three numbers?
#incude<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c,d,avg;
cout<<"enter s numbers";
cin>>a>>b>>c>>d;
d=a+b;
avg=d\3;
cout<<"the average is"<<s;
getch();
}
What is the difference between friend function and inheritance in c plus plus?
There is no such thing. When declaring a friend function only the explicitly-scoped friend is granted private access. The friend function may well be declared virtual within its own class but none of its overrides are granted access unless they are explicitly granted access.
What type of structure is a school?
A school is typically a formal educational institution designed to facilitate learning and instruction. It is structured to include classrooms, administrative offices, libraries, and various facilities such as gyms and laboratories. Schools often have a hierarchical organization, including roles such as teachers, administrators, and support staff, all working together to foster an environment conducive to education. Additionally, schools can vary in type, including public, private, charter, and online institutions, each serving different communities and educational philosophies.
What decimal number corresponds to the binary number 00000111?
When writing binary numbers . . .
The first place has the value of 1.
The second place has the value of 2.
The third place has the value of 4.
The fourth place has the value of 8.
'1 0 1 1 ' has (fourth place) + (second place) + (first place) = 8 + 2 + 1 = decimal 11 .
Compare c plus plus and visual basic?
Visual Basic is a Windows-specific programming language, developed by Microsoft. C++ is a standard, generic and cross-platform programming language. Microsoft's implementation is called Visual C++, but it is not standards-compliant. Visual Basic requires a runtime library. C++ does not. Visual Basic is 100% object-oriented. C++ is not 100% object-oriented, but gives programmers greater freedom of choice. C++ is efficient, compact and performs extremely well on a wide variety of hardware. Visual Basic programs are inefficient, generally large, and much slower than equivalent C++ programs, and only run on Windows.
What do you know about structure programming language?
first write main function and what are the use classes which type you want then give the data members to the member functions finally you will terminate the program
What is the difference between while loop and for loop in c computer language?
For while loop you have to define conditions for the loop in loop's body. In, "for loop" case it's more natural and comportable. For loop is good for numeric simulations in other words when you are using only numbers. Loop while is very good for symbolic conditions, for instance, to check the condition that char1 == char2;
Write a program to generate the sequence?
#include<math.h> main()
{
int s=1,n,x,i;
clrscr();
printf("enter value of n");
scanf("%d",&n);
printf("enter value of x");
scanf("%d",&x);
for(i=1;i<=n;i++)
{
s=pow(x,i);
}
printf("sum of series=%d",s);
getch();
}
Member functions must always be declared inside a class declaration, however they may be defined either inside or outside of the class. A definition is simply the implementation of a function, the code that is executed when the function is called.
When a function is defined inside a class declaration then it is implicitly inline expanded. When it is defined outside of a class declaration, it is not inline expanded but you may explicitly declare it to be inline expanded, if desired. Note that inline expansion should only be utilised when the function has but a few simple statements, preferably just one or two statements at most.
The following example demonstrates the definition of a typical class accessor (a getter) defined within a class declaration (where inline expansion is implied and desired):
class A {
public: int get_data()const{return(m_data);}
private: int m_data;
};
The following example shows the same function defined outside of the class. This time the function will not be inline expanded.
class A {
public: int get_data()const;
private: int m_data;
};
int A::get_data()const{return(m_data);}
Note that the definition may appear in a different file. Generally, classes are designed with a header file and a source file, where the header contains the declarations and the source contains the definition. The source file must include the header file.
Since it is often desirable to inline expand simple class accessors that merely return values, the inline keyword can be used when the definition is external to the class declaration, like so:
class A {
public: inline int get_data()const;
private: int m_data;
};
int A::get_data()const{return(m_data);}
Note that declaring a function inline (implicitly or explicitly) is no guarantee that it will actually be inline expanded, you are merely signalling to the compiler that the function is a candidate for expansion. The compiler is still free to veto the promotion if its inline optimisers deem that such an expansion would compromise performance due to the increased code size that inline expansion incurs. Functions that are called in only one place in your code, regardless of how complex they are, are generally good candidates for expansion. Although you could manually inline expand such functions, if the function call makes your calling code easier to read and maintain, then it's better to retain the function in your code.
Note also that while some compilers allow you to force an inline expansion (such as Microsoft's __forceinline keyword), effectively bypassing the compiler's optimisers, this should be done sparingly as the increased code size can easily outweigh any performance gained by removing the function call. Also note that some functions cannot be inline expanded, even by force. In particular, the compiler cannot inline expand any of the following:
* Some recursive functions can be inline expanded up to a predetermined depth, usually 16 calls at most (thereafter, the calls are treated as calls to new instances of the function). The predetermined depth generally cannot be increased, but it can typically be reduced with a pragma.
For more specific information on inline expansion within your compiler or IDE, consult the compiler's documentation regarding the inline keyword.
typedef float (*pt_func)(int, int); pt_func arr[3];
another way:
float (*pt_func[3])(int, int);
What are the elements of a control system?
stimulus, receptor, afferent pathway, control center, efferent pathway, effector, response
How do you write a c-program to calculate lucky number?
#include <stdio.h>
main()
{
int a,b;
clrscr();
printf("enter a,b values");
scanf("%d%d",&a,&b);
a=b%10;
printf("\nlucky number %d",a);
getch();
}
What is a Water Treatment Operator?
water treatment plant operator is a big need in our country people need safe water to drink. Many sources are not suitable to drink. That's where a water treatment operator play a big role in the picture. They can treat water so that it is safe to drink in their towns, communities, cities, and where ever water need to be treated. Treatment plant operators work indoors and outdoors and maybe exposed to noise,unpleasant odors, and hazadous conditions as well. Plants operates 24 hours 7 days a week. They run different test to make sure they destroy harmful bacteria,micro organism and alge. If you fail to do your job, you could be responsible for an out break of a water borne disease which could even result in death. The projected employment for treatment operators by 2018 is135,900 according to the Projection Data from the National Employment Matrix. Plant operators must be familiar with the regulations to processing good drinking water that are handed down by the U.S Environmental Protection Agencies.
Write program to calculate square of an integer?
#include <stdio.h>
#include <conio.h>
void main()
{
int n=0;
printf("\n\nEnter a number: ");
scanf("%d", &n);
n=n*n;
printf("\nThe square is %d ", n);
getch();
}
BY: Eng . Ali Saed
Is string is primitive or user defined data type?
String - is primitive data type
string - is user defined data type
How do you convert higher level language into lower level language?
Not only can we but we have to! Machine code is the only language understood by the computer, thus all languages, both low and high level, must be converted to machine code in order to execute. Most compiled languages can produce low-level symbolic code (assembly language), but not all, especially those that compile to byte code rather than machine code. However, all code has to be compiled or interpreted to machine code at some point and machine code can be disassembled to produce low-level symbolic code.