What is Kevin in ASCII values?
Determining the ASCII values for any string of characters is simple, requiring a for loop and an understanding of strings.
All a string is in C is an array of characters terminated with ASCII 0 (also known as a zero-terminated string or NUL-terminated string). The following block of code assumes that "sz" is a pointer to your string data and "psz" is a character pointer:
for (psz=sz; *psz; psz++) printf("%02X:%03d ", *psz);
printf("\n");
Step by step, what this code does is:
- Initializes "psz" to the same value as "sz", which means they both point to the address of the first character in the string;
- Checks if the character at the address in "psz" is not zero (meaning not at the end of the string) and, if so, breaks out of the loop;
- Displays a two-character hexadecimal (base 16) and a three-digit (base 10) ASCII representation of the character followed by a space;
- Loops back to the character check
- Displays a newline to move the cursor to the beginning of the next line.
Before the code, and inside your desired function block, define "psz" and "sz" as char* types, and set "sz" to the string "Kevin".
The full listing is as follows:
int main()
{
char *psz, *sz="Kevin";
for (psz=sz; *psz; psz++) printf("%02X:%03d ", *psz);
printf("\n");
return 0;
}
Note that if you're using C++ you'll need to change "char" to "const char".
How do you write a c program for hospital database using priority queue?
#include<stdio.h>
#include<conio.h>
typedef struct prque
{
char p_name[20];
int prn;
struct prque *next;
}prque;
prque * insert(prque *);
prque * delet(prque *);
void display(prque *);
int main()
{
int i,ch,n,prn1;
char p_name1[20];
prque *front;
clrscr();
front=NULL;
do
{
printf("\n1)Patient Entry");
printf("\n2)Delete");
printf("\n3)display Patiant List.");
printf("\n4)Exit");
printf("\nEnter your choice:");
scanf("%d",&ch);
switch(ch)
{
case 1:
front=insert(front);
break;
case 2: printf("\nPatient Name Deleted:%s\n",front->p_name);
front=delet(front);
break;
case 3: display(front);
break;
case 4:exit(0);
}
}while(ch!=4);
getch();
return 0;
}
prque *insert(prque *front)
{
char p_name[20];
int prn;
prque *temp,*current,*prev;
temp=(prque*)malloc(sizeof(prque));
printf("\nEnter patient name:");
scanf("%s",temp->p_name);
printf("\nEnter Status:\n1)General Check up\t2)Non Serious\t3)Serious.\t");
scanf("%d",&prn);
temp->prn=prn;
temp->next=NULL;
if(front==NULL)
{
front=temp;
}
else
{
if(prn>front->prn)//Insert at front
{
temp->next=front;
front=temp;
}
else if(prn<=front->prn) //insert at middle
{
current=front;
while(current->prn>=prn && current!=NULL)
{
prev=current;
current=current->next;
}
temp->next=prev->next;
prev->next=temp;
}
}
return(front);
}
prque * delet(prque *front)
{
prque *temp;
if(front==NULL)
{
printf("\nQueue is Underflow.");
return(front);
}
else
{
temp=front;
front=front->next;
free(temp);
}
return(front);
}
void display(prque *front)
{
prque *p;
p=front;
printf("\n--------------------------------------------------");
printf("\n\tPatient Name\t\tPriority\n");
printf("--------------------------------------------------");
while(p!=NULL)
{
printf("\n\t%s",p->p_name);
if(p->prn==3)
printf("\t\t\tSerious");
else if(p->prn==2)
printf("\t\t\tNon serious");
else if(p->prn==1)
printf("\t\t\tGenaral Checkup");
p=p->next;
}
}
/*
Output:
1)Patient Entry
2)Delete
3)display Patiant List.
4)Exit
Enter your choice:1
Enter patient name:Afridi
Enter Status:
1)General Check up 2)Non Serious 3)Serious. 3
1)Patient Entry
2)Delete
3)display Patiant List.
4)Exit
Enter your choice:1
Enter patient name:Ponting
Enter Status:
1)General Check up 2)Non Serious 3)Serious. 2
1)Patient Entry
2)Delete
3)display Patiant List.
4)Exit
Enter your choice:1
Enter patient name:Sangakara
Enter Status:
1)General Check up 2)Non Serious 3)Serious. 3
1)Patient Entry
2)Delete
3)display Patiant List.
4)Exit
Enter your choice:
1
Enter patient name:Clerke
Enter Status:
1)General Check up 2)Non Serious 3)Serious. 1
1)Patient Entry
2)Delete
3)display Patiant List.
4)Exit
Enter your choice:2
Patient Name Deleted:Afridi
1)Patient Entry
2)Delete
3)display Patiant List.
4)Exit
Enter your choice:1
Enter patient name:Vittori
Enter Status:
1)General Check up 2)Non Serious 3)Serious. 2
1)Patient Entry
2)Delete
3)display Patiant List.
4)Exit
Enter your choice:1
Enter patient name:Dilshan
Enter Status:
1)General Check up 2)Non Serious 3)Serious. 3
1)Patient Entry
2)Delete
3)display Patiant List.
4)Exit
Enter your choice:1
Enter patient name:Malinga
Enter Status:
1)General Check up 2)Non Serious 3)Serious. 1
1)Patient Entry
2)Delete
3)display Patiant List.
4)Exit
Enter your choice:2
Patient Name Deleted:Sangakara
1)Patient Entry
2)Delete
3)display Patiant List.
4)Exit
Enter your choice:3
--------------------------------------------------
Patient Name Priority
--------------------------------------------------
Dilshan Serious
Ponting Non serious
Vittori Non serious
Clerke Genaral Checkup
Malinga Genaral Checkup
1)Patient Entry
2)Delete
3)display Patiant List.
4)Exit
Enter your choice:2
Patient Name Deleted:Dilshan
1)Patient Entry
2)Delete
3)display Patiant List.
4)Exit
Enter your choice:2
Patient Name Deleted:Ponting
1)Patient Entry
2)Delete
3)display Patiant List.
4)Exit
Enter your choice:2
Patient Name Deleted:Vittori
1)Patient Entry
2)Delete
3)display Patiant List.
4)Exit
Enter your choice:2
Patient Name Deleted:Clerke
1)Patient Entry
2)Delete
3)display Patiant List.
4)Exit
Enter your choice:2
Patient Name Deleted:Malinga
1)Patient Entry
2)Delete
3)display Patiant List.
4)Exit
Enter your choice:2
Patient Name Deleted:(null)
Queue is Underflow.
1)Patient Entry
2)Delete
3)display Patiant List.
4)Exit
Enter your choice:4
*/
Written by: Fabianski Benjamin
What is the difference between C and C Sharp?
#1) C is unmanaged code, and C# is managed by the .NET CLR (Common Language Runtime)
Managed code means that many of the low-level activities that one has to worry about with C, such as memory management, garbage collection, pointers, etc, are automatically handled for you.
#2) C# is an object orienated language. C is a structed language. However, if you were referring to C++, then both C# and C++ have similar (although not identical) object orienated capabilities.
AnswerC is a procedural programming language developed in AT&T-Bell labs. It has been in use for about four decades for system and application programming. It has been ported to lots of CPUs and operating systems.C-sharp (C#) is an object oriented programming language developed by Microsoft for use in its .NET framework. It is much newer, and only works on Microsoft operating systems. C#, like many other programming languages, is a descendant of C - they share some syntactic conventions.
What is the function of the crontab file in Linux?
Unix Cron is a daemon ('service') that runs in the background and runs the commands specified in the crontab file at the intervals specified within. This allows someone to easily run a program or script every hour, day, week, etc.
The crontab file can be found in two places. Typically, it is located in the /etc directory. Cron also supports multi-user setups, in which case you will also find other 'crontab' files in some distribution-specific location (I believe /var/spool/cron, named after the user that owns the file).
More information on Cron can be found by Googling "cron" or "crontab".
C plus plus programme to count non-vowels in a file of test?
#include<iostream>
#include<fstream>
#include<string>
int main()
{
size_t count=0;
std::string vowels ("aeiouAEIOU");
std::ifstream ifs;
ifs.open ("test.txt", std::ios::in);
if (ifs.bad())
{
ifs.close();
std::cerr << "Invalid input file.\n" << std::endl;
return;
}
while (!ifs.eof())
{
char c = ifs.get();
if ((c>='a' && c<='z') (c>='A' && c<='Z'))
if (vowels.find (c) != vowels.npos)
++count;
}
ifs.close();
std::cout << "The file has " << count << " non-vowels.\n" << std::endl;
}
Is built-in data-type are abstract data-types in java?
All built-in data types are not abstract data types.
What are the advantages of case sensitive languages?
A case sensitive language gives you more flexibility in naming variables. It also lets you use the same variable name more than once for different purposes by changing different letters to upper or lower case, each version being treated as a separate variable. In practice, this is not recommended as it can cause confusion in reading programs and keeping track of which variable has what purpose.
How can you make diamond in C programming?
There is insufficient information in the question to answer it properly. What do you mean by "diamond". Are we talking Pascal's Triangle. Are we talking a diamond shaped field of stars? What? Please restate the question.
Program to check that given string is palindrome or not in C?
/*To check whether a string is palindrome*/
void main () { int i,j,f=0; char a[10]; clrscr (); gets(a); for (i=0;a[i]!='\0';i++) { } i--; for (j=0;a[j]!='\0';j++,i--) { if (a[i]!=a[j]) f=1; } if (f==0) printf("string is palindrome"); else printf("string is not palindrome"); getch (); }
Calculate the Time and Space complexity for the Algorithm to add 10 numbers?
The algorithm will have both a constant time complexity and a constant space complexity: O(1)
To display an input string vertically by c?
// get input
char input[256];
gets(input);
// print one character on each line
int i;
for(i = 0; input[i] != '\0'; ++i) {
printf("%c\n", input[i]);
}
Line drawing simple dda algorithm in c?
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<ctype.h>
#include<math.h>
#include<stdlib.h>
void draw(int x1,int y1,int x2,int y2);
void main()
{
int x1,y1,x2,y2;
int gdriver=DETECT,gmode,gerror;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi:");
printf("\n Enter the x and y value for starting point:\n");
scanf("%d%d",&x1,&y1);
printf("\n Enter the x and y value for ending point:\n");
scanf("%d%d",&x2,&y2);
printf("\n The Line is shown below: \n");
draw(x1,y1,x2,y2);
getch();
}
void draw(int x1,int y1,int x2,int y2)
{
float x,y,xinc,yinc,dx,dy;
int k;
int step;
dx=x2-x1;
dy=y2-y1;
if(abs(dx)>abs(dy))
step=abs(dx);
else
step=abs(dy);
xinc=dx/step;
yinc=dy/step;
x=x1;
y=y1;
putpixel(x,y,1);
for(k=1;k<=step;k++)
{
x=x+xinc;
y=y+yinc;
putpixel(x,y,2);
}
}
Write Shell programme to check number is perfect or not?
Write a shell program to test whether the given number is a perfect number or not.
#includeIs type checking on pointer variables stronger in assembly language or in c plus plus?
C++ imposes far greater restrictions on pointer typing than assembly language. There is only a single type of pointer in assembly, which is only "typed" in any sense when dereferenced, and even then only by size. C++ pointer typing takes into account not only the size of the type of the referent, but a number of other factors, such as its relationship to other types in the class hierarchy. The only way to disable these safety checks is to explicitly break the type system using reinterpret_cast.
How do you use sscanf() in C file handling?
You can find in-depth information on how to use sscanf() in C file handling on crasseux.com/books/ctutorial/sscanf.html
One more useful website of learning basic of "c programming" is cprogramming-bd.com
Why is searching in a sorted list faster than searching in an unsorted list?
With an unsorted list you have to search from the beginning to locate the item you're looking for. This is a linear search which takes linear time O(n) for n items. That is, the best case is constant time O(1) if the item you're looking for is the first item, it is O(n) if it is the last item (or the item doesn''t exist). Thus, on average, searches will take O(n/2) if the item exists, but always takes O(n) if it doesn't.
With a sorted list you start in the middle of the list. If the item you're looking for is less than this item, you can safely discard the upper half of the list but if it is greater you can discard the lower half. In other words you reduce the number of items to be searched by half. You then repeat the process with the remaining half. If the item you're looking for is equal to the middle item, you're done, but if the remaining half has no items the item does not exist. This is a logarithmic search with a best case of O(1), a worst case of O(log n) and an average case of O((log n)/2).
Logarithmic searches are clearly faster, on average, than linear searches. However, logarithmic searches require two separate comparison operations (equal to and less than) while linear searches require just one (equal to). Thus for a list of three or four items, a linear search is arguably quicker. But for larger lists, logarithmic search is quicker. Note that we don't need to test for greater than since it can be assumed that if an item is neither less than or equal to another item, then it must be greater.
What is the difference between passing by value and passing by difference?
Passing by value is where you pass the actual value (be it an integer, an array, a struct, etc.) to a function. This means that the value must be copied before the function is called and therefore the value in the caller cannot be modified within the callee. Passing by reference is where a reference/pointer to a value is passed to a function. The reference often takes up less space than copying the actual value (particularly when the value is a struct or an array) and allows you to manipulate the value in the caller within the callee.
Loops are used in C to speed up algorithms that do a process repeatedly with the same or very similar values. For example, if you have to write a program to add together all of the number 1 to 10 and print out the value you get you could do it 2 ways:
1. Without a loop:
int a = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10;
printf("%d", a);
2. With a loop:
int a = 0;
for(int i = 1; i <= 10; i++){
a += i;
}
printf("%d", a);
As you can see, solution 2 took about the same amount of time to code as solution 1 BUT when you get into more complex things, or just things that involve more values, loops come in handy. For example, say you want to add up all of the numbers from 1 to 100 or 1 to 1000, it would take much longer to write that out as hard code rather than just to use a loop.
Does it matter if you get a stud or a loop for your first earlobe piercing?
Answer I wear hoops, 1 gauge, 1 body piercing, and studs. If it is your first Ear Lobe piercing it is best to get pierced with a stud, and go for a good strong noncorrosive metal (14k or titanium, cheaper stuff like copper, NOT A GOOD MOVE!). Studs have a less chance of being ripped out or caught on anything, Cleaning is simple and healing is rather quick in my opinion. You should never get pierced with a hoop you cause complications with the healing process and your piercer should know that.
Personally I wouldn't use a hoop because you will most likely changed the size of the hole. Studs are the way to go for the healing period with lobes. The process is quick and practically painless. But if you pierce any other part of your ear you are going to want to look for a piercer. - Hope that helped, Cheeky6682
AnswerIt's better to start with a ring, a good quality ring made of 316LVM Steel, Titanium, or 14kt gold or better.
Studs are made of cheap metal in most cases, and the design of the stud can impede your healing.
AnswerI would advise a stud because I have found them more comfortable to sleep on and keep clean, but a hoop works as well.
AnswerIt is easier to clean a hoop because it is harder to push the stud out to make sure the cleaning solution gets into the piercing but it is just personal preference.-Answer, Meyshi07- Well.. if you are ever wanting to wear a hoop, start with a hoop, its a LOT harder switching form a stud to a hoop because, well the stud is pierced straight,the hoop is curved, I got my cartilage pierced with a stud and had a hell of a time trying to wear a hoop, got all sorts of infected and took me a year to just give up and take the pain till the hoop fit and healed. I still have problems keeping the hoop comfortable at times. My advice go with a hoop if u plan on wearing one neways, and to the answer about rings catching on things, its reversed a stud catches on things easier than a hoop =P
Answer ; Get it pierced with a stud. After it heals then you can wear loops.
ANSWER: Now, I don't know where there people are getting their information from, but it's best to go to a PROFESSIONAL PIERCER who would put a hoop in instead of a stud. When you pierce anything, it's going to swell. HOOPS allow the piercing to heal and also allows the piercing to have room to swell. Cartilage is completely different than the ear lobe, and should be treated differently.
Piercing guns aren't very good for healing, because they actually blast the hole into your ear instead of making a clean hole.
Cleaning hoops are simple. Just wash off the crusties in the shower with antibacterial soap (Dial works well) and put a little bit of antibiotic gel (Neosporin) on the edge of the piercing/ring and work in back and forth.
(My credentials; I'm apprenticing at a body piercing shop.)
It's in essence (from a very high-level view), when a node is attacked and then "captured". So first we need to define "node". A node can be like your laptop, a switch at the ISP (CenturyLink, etc.), a router, etc.
Think of it like streets. The car (data), drives along through an intersection (a node), and keeps driving along until it makes it to wherever it's headed (say your computer. Well let's say your tired of always having red lights at a certain intersection, so one day you decide that you take over the "light control box". Traffic is still going through, but you control it. We could even say that the "light control box" is connected to the "traffic camera" box. So now, aside from controlling the cars (data/packets), you can also capture their license plates, and in essence "capture the packet". Now that you can control the traffic, and you know what cars drive through when and from where, and how often, you decide to do some "post-exploitation attacks". You decide that you'll redirect traffic from the highway to the one way street (flood attack), or hijack cars, switch license plates, etc.
Poor example, but hopefully that helps some.
What is polynomail time algorithm?
That means, roughly speaking, that for any input of size "x", the algorithm will take no longer than xn for some constant "n".
C program to copy one matrix to another matrix?
#include
What is a symbolic constant in c language?
symbolic constants are constants represented by symbols....
constants are values that does not change through out the program execution.
e.g
#include<stdio.h>
#include<conio.h>
#define NUM 15
void main()
{
int a=NUM;
printf("The constant is %d",a);
getch();
}
here #define is a preprocessor. its job is to replace all the entries named NUM as 15. So that the compiler works with the constant 15...