#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<alloc.h>
void main()
{
int i=-1,j;
char ch='y';
struct emp
{
int eno;
char ename[30];
int salary;
};
struct emp *p;
clrscr();
p=(struct emp *)malloc(sizeof(struct emp));
while(ch=='y'ch=='Y')
{
i++;
printf("\nenter the employee id:-");
scanf("%d",&p[i].eno);
printf("\nenter the employee name:-");
scanf("%s",&p[i].ename);
printf("\nenter the salary:-");
scanf("%d",&p[i].salary);
printf("\ndo you want to continue(Y|N):-");
scanf("%s",&ch);
}
printf("\ninfromation about employees\n");
printf("employee id| employeename| salary");
printf("\n-----------|-------------|-------\n");
for(j=0;j<=i;j++)
{
printf("\n%d | %s | \%d",p[j].eno,p[j].ename,p[j].salary);
}
getch();
}
/*--------------------OUTPUT--------------
enter the employee id:-101
enter the employee name:-peersaab
enter the salary:-12000
do you want to continue(Y|N):-y
enter the employee id:-102
enter the employee name:-santosh
enter the salary:-15000
do you want to continue(Y|N):-n
infromation about employees
employee id| employeename| salary
-----------|-------------|-------
101 | peersaab | 12000
102 | santosh | 15000
*/
Write an algorithm that reads 2 numbers from keyboard and displays their sum.?
#include<stdio.h>
int main(void) {
int a, b;
printf("Enter two numbers: ");
scanf("%d\n%d\n", &a, &b);
printf("%d + %d = %d\n", a, b, a+b);
return 0;
}
Write a program in c to print characters from A to z and Z to A?
Use this code:
#include <iostream>
using namespace std;
int main()
{int x;
for(x=0; x<27; x++)
if(x 26) cout<< "z" << endl;
return (0);
}
What is low level programing languages?
The programs written in Machine codes (like hexadecimal codes) are the Low level programs. These are understood only by the Microprocessor they are written for and written on.
Whereas the High level programs are written in English like languages which are human redable.
How to save output in separate file for c programs?
You can have more than one output-file opened in the same time, see manuals of functions fopen, fclose, fwrite, fprintf, ...
Thousands! Programming languages number in the thousands, from general purpose programming languages such as C++, Java, and others, to special purpose languages which are used in one application. They can be ordered by type (structured, object-oriented, functional, etc.) or by history, or syntax. See the related list of programming languages.
Is PHP a compiler or interpreter?
It is normally interpreted by another computer program. However subsets of the language can be compiled.
A program in c that identifies the longest word in a sentence?
#include<stdio.h>
#include<string.h>
#include<conio.h>
void main()
{
int i,max=0,count=0,j;
char str[100]; /* ={"INDIA IS DEMOCRATIC COUNTRY"}; u can use a string inside,in place of user input */
printf("\nEnter the string\n:");
gets(str);
for(i=0;i<strlen(str);i++)
{
if(!(str[i]==32))
{
count++;
}
else
{
if(max<count)
{
j=i-count;
max=count;
}
count=0;
}
}
for(i=j;i<(j+max);i++)
printf("%c",str[i]);
getch();
}
Where can you download MicroType pro for free?
yes you can but i am trying to find out where you can!!
What is basic terminology for data structure?
Transversing
Accessing each record exactly once so that certain items in the record may be processed.(This accessing or processing is sometimes called 'visiting" the records.)
Searching
Finding the location of the record with a given key value, or finding the locations of all records, which satisfy one or more conditions.
Inserting
Adding new records to the structure.
Deleting
Removing a record from the structure.
Sometimes two or more data structure of operations may be used in a given situation; e.g., we may want to delete the record with a given key, which may mean we first need to search for the location of the record.
Give 10 example of close loop control system?
1. lightswitch --> light
2. Toaster --> toast (For timer-based toasters, only -- see below)
3. Water faucet --> water flow amount
4. Water faucets (hot/cold) --> water temperature in the sink or shower.
5. Temperature setting for the stovetop --> heat to cook food
6. TV remote control
7. Clothes dryer (timer based)
8. Volume on a stereo / home entertainment system
9. shades / blinds on a window --> 'regulating' the amount of light coming in from the outside.
10.
Closed loop:
1. Thermostat --> furnace (constant temperature)
2. Toaster setting (light/dark) --> toast (IF the toaster has heat sensors)
3. Refrigerator cold/hot setting --> refrigerator inside temperature (constant)
4. Temperatue setting for oven (not stovetop) --> oven temperature constant
5. Clothes dryer with moisture sensor
6. Washing machine water level
How would you write a c program using nested loop that output the values are 1 22 333 4444 55555?
The solution is two use a nested for loop:
int startingNum = 1;
int maxNum = 10;
for(int currentNum = startingNum; currentNum <= maxNum; currentNum++)
{
for(int j = 0; j < currentNum; j++)
{
printf("%d", currentNum);
}
printf("\n");
}
What are Static variables in c?
A static variable in C is a variable whose value and memory allocation persists throughout the execution of the program. If the variable is declared at file scope (outside of any blocks) the static attribute means the variable is visible only to the file containing it, i.e. it can not be referenced through an extern reference in a different file.
Any type will do, here is an example:
for (leave= 0, nnum= 0; ! leave; ) {
rc= scanf ("%d", &number);
if (rc!=1 number==-1) { leave=1; continue; }
++nnum;
... do something with number ...
}
How the array has to be declared and initialized?
An example might help
int myarray [] = {2,0,1,3,1,1,2,9};
What Is The Difference Between Control and Uncontrolled statements?
ctrl statements ctrl the flow of pgrm execution with the given condisn but ctrl transfer statemens causes the change in pgrm flow without any condisn....
What are the attributes of good programming languages?
There are many attributes that make up a good programming language. Here are some of the most important ones:
Readability: A good programming language should be easy to read and understand. This makes it easier for developers to write and maintain code, and reduces the likelihood of errors.
Maintainability: A good programming language should be easy to maintain and update. This includes having clear and concise syntax, as well as tools for debugging and testing.
Performance: A good programming language should be efficient and fast. This includes having a low memory footprint, minimal overhead, and fast execution times.
Portability: A good programming language should be portable, meaning it can run on different platforms and operating systems without significant changes.
Flexibility: A good programming language should be flexible enough to accommodate different programming styles and paradigms, as well as be extensible with libraries and frameworks.
Safety: A good programming language should prioritize safety and prevent common programming errors, such as null pointer dereferences or buffer overflows.
Community: A good programming language should have a supportive and active community of developers who contribute to its development, documentation, and maintenance.
Tooling: A good programming language should have a robust ecosystem of tools, such as editors, IDEs, and build systems, that make development and deployment easier and more efficient.
Scalability: A good programming language should be able to scale with the needs of the project, whether it be a small script or a large-scale enterprise application.
Future-proofing: A good programming language should be designed with a long-term vision, taking into account future developments in hardware, software, and technology trends.
List two types of errors that can lead to an infinite loop?
Quite simply: a circular function in the programming, not going anywhere.
Why don't you directly specify the number of bytes to reserve to store data in memory?
You don't directly specify the number of bytes to reserve in memory to store data because you don't necessarily know how many bytes that data requires.
Instead, you specify the type of data and the number of elements, and the compiler and run-time library figures out how many bytes to allocate.
Its a portability issue. You don't want to tie your code to a specific word size because the code would then break when the underlying platform changes. One very famous example of this is the int data type in MS Windows 3.x. That was a 16-bit integer. When Windows "grew up" and the int became a 32-bit integer, the int changed to 32-bit, and everyone's code broke, except those that planned ahead and wrote the code correctly.
How do you convert decimal number to binary number using while loop?
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
long int a[20],i,n,count=0,b[20],c[20],sum=0;
printf("ENter the number in binary form=\t");
scanf("%ld",&n); // Get a binary number from the user
for (i=0;n>=1;i++)
{
a[i]=n%10;
n=n/10; // Loop To reverse the number And put all reversed numbers in arry a[i]
count=count + 1; // count to count the number of times this loop runs
}
for (i=0;i<=count-1;i++) // count -1 condition is used to run the loop till the previous loop run
{
b[i]=pow(2,i); // This is to raise the power of 2 to no of times previous loop runned.
}
for (i=0;i<=count-1;i++)
{
c[i]=a[i] * b[i]; // Multiply a[i] or reveresed binary no with b[i] or increasing pow of 2 to count-1
sum=sum +c[i]; // it is to add the c[i] elements with each other n put into sum variable.
}
printf("Decimal form =%ld",sum); // printing the sum to get the decimal form
getch();
}
// Hope it solves your problem, ANy more assistance honey.gupta13@yahoo.com ffffff
Why do you need signed and unsigned integer?
We need signed integers in order to represent both negative and positive values. However, some numbers can never be negative. For instance, the size of a file must always be greater than or equal to zero so we use unsigned integers to represent file sizes. Also, natural numbers must be greater than 0 so there's no point in using a signed value to represent a natural number. Signed integers also use one bit to denote the sign, but unsigned integers do not thus unsigned integers can effectively represent twice the range of positive values than an unsigned integer can. For instance, an 8-bit signed value can represent values in the range -128 to +127 using twos complement notation, but an 8-bit signed value can represent values in the range 0 to 255.
Write a C program to print numbers from 1 to 999 in words?
write a c program which reads an integer value from the keyboard then it displays the number in words?
#include<stdio.h>
#include<conio.h>
void main(void)
{
int rev,n,
clrscr();
printf("\n enter any number");
scanf("%d",&n);
temp=n;
while(n>0)
{
rem=temp%10;
rev+=rem*10;
temp=temp/10;
choice=rev%10;
switch(choice)
{
case 1:
printf("one");
break;
case 2:
printf("two");
break;
case 3:
printf("three");
break;
case 4:
printf("four");
break;
case 5:
print("five");
break;
case 6:
printf("six");
break;
case 7:
printf("seven");
break:
case 8:
printf("eight");
break:
case 9:
printf("nine");
}
getch();
}
What are the unique advantages of object oriented programming paradigm?
a. OOP provides a clear modular structure for programs which makes it good for defining abstract datatypes where implementation details are hidden and the unit has a clearly defined interface.
b. OOP makes it easy to maintain and modify existing code as new objects can be created with small differences to existing ones.
c. OOP provides a good framework for code libraries where supplied software components can be easily adapted and modified by the programmer. This is particularly useful for developing graphical user interfaces.
What is difference between c and pro c?
C is the computer language bases on K&R's language that has evolved over the years. It includes C++, as extended by Stroustroup..
Pro*C is an Oracle precompiler that will read a C or C++ program, detect Oracle extensions to it, and convert it to native code for subsequent processing by the C or C++ compiler. This involves building the data structures and function calls needed to use Oracle while passing the non-Oracle C or C++ code through intact. The amalgamated code is then processed by the C or C++ compiler and it now works with Oracle.
What is an example of a pretest loop?
Well, from my knowledge of pseudocode, a pre-test loop contains the DO WHILE and LOOP functions.
So say you want to pour some milk into your cereal for breakfast:
DO WHILE cereal_bowl.Full = False
Pour_Milk
LOOP
Basically this is you saying, I am going to pour milk WHILE the bowl is not full. Once the bowl is full you will stop because you checked before your poured (a pre-test).
Hope this helps.
- The Doctor