answersLogoWhite

0

📱

C Programming

Questions related to the C Computer Programming Language. This ranges all the way from K&R to the most recent ANSI incarnations. C has become one of the most popular languages today, and has been used to write all sorts of things for nearly all of the modern operating systems and applications. It it a good compromise between speed, power, and complexity.

9,649 Questions

How to make a game flames in a turbo c program with a use of string punctions?

01#include<stdio.h>

02#include<conio.h>

03#include<string.h>

04

05void main()

06{ char str1[20];

07 char str2[20];

08 int x,y,n,r,counter1,counter2,points=0;

09

10 clrscr();

11 printf ("Please enter a name: \n\n");

12 gets(str1);

13

14 printf ("\nEnter another name: \n\n");

15 gets(str2);

16

17 counter1=strlen(str1);

18 counter2=strlen(str2);

19

20 for (x=0; x<counter1; x++)

21 { for (y=0; y<counter2; y++)

22 { if (str1[x]==str2[y])

23 points++;

24 else;}

25

26 if(points!=0)

27 points++;

28 }

29

30 for (n=1; n<counter1; n++)

31 { if (str1[0]==str1[n])

32 points++;

33 else;}

34

35 printf ("\n%d \n",points);

36

37 r=points%6;

38 switch®

39

40 {

41 case 1: printf ("\nFriends"); break;

42 case 2: printf ("\nLovers"); break;

43 case 3: printf ("\nAnger"); break;

44 case 4: printf ("\nMarriage"); break;

45 case 5: printf ("\nEngaged"); break;

46 case 0: printf ("\nSweethearts"); break;

47 }

48

49

50

51 getch();

52 }

What are various types of data conversion that can not be handled by compiler?

Data conversion which culminate in loss of data will usually lead to the generation of warning messages.

Eg: from float to int.

These conversions should be explicit.

Also conversion between two different objects is only possible if there is a function specifying the conversion method.

Write C coding for swamping the values of two variables without using a third variable?

I'll assume you meant to say: Swapping instead of Swamping.

You would need to perform the XorSwap algorithm:

void XorSwap(int *x, int *y) {

if(x != y) {

*x ^= *y;

*y ^= *x;

*x ^= *y;

}

}

You can read more about this algorithm on Wikipedia.

How do you improve insertion sort algorithm?

If there was a way, it would be the new insertion sort! Theoretically you could reduce the time by using a linked list and searching to the position it needs to be inserted and inserting it. In practice however you would be better off simply using a different sort, especially if you don't want your data in a linked list.

Selection sort is better when writing is expensive. Quicksort and Mergesort are faster on large data sets.

What is console in c?

Nothing. (You can use this word as identifier though.)

How do you do the infinite loop on Portal?

If a game is hard you wanna know what i do? go to my favorite game site

WWW.Arcadeprehacks.com <-------------Hacked games

Why scanf functions is not used to read a line of text?

Because it is not safe. Scanf puts the data into a buffer. There is no size checking so the data may be larger than the buffer causing a buffer overrun with undefined (usually bad but always undesirable) behavior.

Can the component type of an array be a struct?

Yes:

struct employeeType

{

string firstName;

string lastName;

int personID;

double monthlyBonus;

}employees;

**Or if you don't want to declare the variable in the struct, erase the bold and add this line to declare the variable:

employeeType employees;

What this does:

Creates array employees from employees[0]-employees[49]

In each location (ie: employees[0]) will be the struct employeeType

employees[0] =

{

string firstName;

string lastName;

int personID;

double monthlyBonus;

}

employees[1] =

{

string firstName;

string lastName;

int personID;

double monthlyBonus;

}

...and so on to:

employees[49]

{

string firstName;

string lastName;

int personID;

double monthlyBonus;

}

What are the five main methods of panchakarma?

The five main methods of panchakarma are therapeutic vomiting (vamana ), purgation (virechana ), enema therapy (niruha basti for medicated enemas and anuvasana basti for oil enemas), and nasal cleansing (nasya ).

What is lvalue explain with example?

left-value: an expression that can be target of assignement.

eg:

array[x+1]->field = 100; # okay

100 = 200; # NOT okay: not lvalue

intvar = 100; # okay

(char *)intvar = "STR"; # NOT okay: not lvalue

*(char **)&intvar = "STR"; okay

How do a vicelord stack?

Vicelords stacj by throwing up numerous signs represnting their set.

What is unable to open 'COS.OBJ' in the c program?

Go TO Option > Directories

First One Should Be "C:\TC\INCLUDE"

Second One Should Be "C:\TC\LIB"

How can you display system tray icon using visual c plus plus?

You add an icon to the system tray by invoking the Shell_NotifyIcon function. This function can be found in the Shell32.dll dynamic link library file. To make use of it, your program must include the Shellapi.h header file and link to the Shell32.lib library.

For more information, press F1 while Visual C++ is active to load the Microsoft Help Viewer (or MSDN if using an earlier version), then search for "Notifications and the Notification Area". The notification area has been known historically as the system tray or status area. Also consult the Windows User Experience Interaction Guidelines for best practices in the use of notifications.

Can you define a function inside a function?

No. Functions should be defined separately. So you would not define a function within a function. You can define one function, and while defining another function, you can call the first function from its code.

How can you create a comment in a C plus plus program?

There are two ways:

The single line comment with a double slash //. Everything after the double slash on a single line is commented out.

The multi-line comment using a /* to open, and a */ to close.

A good IDE will color code the comments instantly.

How do you use sin in c plus plus?

#include<iostream>

int main()

{

std::cout << "sin(1) = " << std::sin(1.0) << std::endl;

std::cout << "cos(1) = " << std::cos(1.0) << std::endl;

std::cout << "tan(1) = " << std::tan(1.0) << std::endl;

std::cout << "asin(1) = " << std::asin(1.0) << std::endl;

std::cout << "acos(1) = " << std::acos(1.0) << std::endl;

std::cout << "atan(1) = " << std::atan(1.0) << std::endl;

}

Output:

sin(1) = 0.841471

cos(1) = 0.540302

tan(1) = 1.55741

asin(1) = 1.5708

acos(1) = 0

atan(1) = 0.785398

How old is Char Margolis?

TV psychic Char Margolis is 65 years old (birthdate: August 21, 1951).

How do you save a text file as c file on mac?

From editor: File / Save As or File / Write To

From shell: rename, move, mv

What is merging operation in data structure?

Merging is combining the records in two different file into a single file.