What do you do if it gets ocward between you and your girlfriend?
Tell her that you want to improve your relation ship with her and that you love her . . . . ( but only if you truly do of course )
Write algorithm of a largest number in three numbers?
1. Read the 3 nos a,b,c
2. Let larget = a
3. if b > largest then largest = b
4. if c > largest then largest = c.....
If you have to process more nos, read all of them in an array. Assume the first element be largest, do comparison through all elements of the array....
Similar algorithm can be developed for finding the lowest also.
/*lab practice 2 damithguruge question 4 */
#include<stdio.h>
int main()
{
int num1,num2,num3,num4;
int smallest;
printf("Please enter a number1");
scanf("%d%*c", &num1);
printf("Please enter a number2");
scanf("%d%*c" ,&num2);
printf("Please enter a number3");
scanf("%d%*c", &num3);
Printf("Please enter a numbe4r");
scanf("%d%*c", &num4);
/* num1 set as the smallest */
smallest=num1;
if(smallest > num2) then
smallest=num2;
else
if smallest >num3 then
smallest=num3;
else
if smallest>num4 then
smallest=num4;
printf("smallest number:%d\n,smallest");
return(0);
endif
endif
endif
}
int maxprod (int n)
{
return n/2;
}
int main (void)
{
int n, a, b;
n= 7; /* for example */
a= maxprod (n);
b= n-a;
printf ("%d+%d=%d, %d*%d=%d\n", a, b, a+b, a, b, a*b);
}
What is recursive epistemology?
· Knowledge is produced on the basis of a non-reflexive epistemology (Bateson's "bad" epistemology).
· The knowledge produced is thus assumed to be "objective" and "true" (i.e. independent of the means of its production; ignorant of its genesis).
· This tends to have a psychologically limiting effect with respect to alternative knowledge and especially alternative modes of knowledge production. One's viewpoint becomes ossified.
· The unreflective assumption of the "truth" of the knowledge becomes justification for its projection, often forcefully, onto other people and processes in the environments surrounding the knower. A sense of conviction that the world is "like this" leads to inflexible protocols in our institutions and in our modes of interaction with others. In other words, outer processes are also ossified; they become sclerotic.
Calibration and Self-Calibration.But what does it mean to have a self-reflexive epistemology? The difference between the two types of epistemologies, non-self-relfexive and self-reflexive, can be described by the first and second order difference. A non-self-reflexive epistemology is a first-order epistemology, a process of creating knowledge that operates in a linear fashion. The knowledge it generates is not explicitly connected to the process of its generation, and thus does not act as a potential corrective to its mode of production. Epistemology is a tool for knowing; but with a non-self-reflexive epistemology, the tool's operation does not change the tool, so that no matter what job it is called to do, it re-instances any new creations in the manner and style of its past processes-regardless of what might be new in the situation it encounters. The kind of newness that comes from a linear epistemology is innovative, but not radical. It is well-suited to the kinds of knowledge domains that work towards technical, but not paradigmatic, advances.To use a term from cybernetics, a linear epistemology is not open to calibration. But this lack of openness to calibration is often not simply passive, but active: attempts at calibration are often either discarded or met with increasing rigidity, with a sort of "doubling-down" on the knowledge already produced by the epistemology, and an increasing unwillingness to change the process by which knowledge is produced. We could therefore describe this kind of epistemology as willfully ignorant. This can actually be quite beneficial in producing new knowledge (within the parameters already accepted by the epistemology), because it minimizes the recursive complexity and is more amenable to simplification. Reductionisms of all types, where all phenomena, regardless of their complexity, are explained only in terms of more simple (and often more abstract) entities, are linear epistemologies. Said differently, a linear epistemology allows one to ignore second-order alternatives. Most of modern scientific thinking rests on the back of linear epistemology, to which it is well-suited.
On the other hand, a self-reflexive epistemology is a second-order epistemology (see Table 1 below for a comparison of qualities). The process allows itself to be changed by the content it produces. It is thus an open epistemology that operates on the basis of a recursion between process and content. It is open to calibration, and not simply in a passive way, but actively: it seeks calibration of its own processes through an active monitoring of what it is generating. Whereas a linear epistemology tends to minimize calibrative influences (changes in the way it operates at a second-order level), a recursive epistemology actively embodies them at its heart; it is not merely open to calibration, but is self-calbrative. The linking of process and content in this recursive way is akin to the creation of a new type of sensitivity; we can metaphorically say that operating with a recursive epistemology is the development of a new type of higher sense-organ for a knowing system. This is another way of saying that what a system distinguishes distinguishes its distinguishing. Recursive epistemology is open to self-revision not only at the content level (which is also true of linear epistemologies, although there may still be a difference in their relative inertia to this change), but also at the process level. This means that the kind of newness it can potentially yield includes radical, as well as technical shifts. Radical shifts restructure the further possibilities that are available to the knowing system; they are paradigmatic shifts.
What is important to consider is that the recursion between knowledge and knowing (between content and process) actually applies to allepistemologies, even first-order epistemologies. It is simply that in the case of a first-order epistemology, the epistemology is not systemically inclusive of this fact; we could say that it is not sensitive to its own sensitivity. A second-order epistemology is sensitive to its sensitivities: it includes processes whose content is other processes. The most tightly recursive epistemologies have processes whose content is itself.
The Unknown and Unknowing.Every epistemology has its boundary, a place where it meets a kind of threshold of what it can so far distinguish to itself. Here again we have a first and second-order difference. The first-order level to this threshold is the possible content that could be revealed there, if only our knowing could continue across the threshold. This is the unknown, as a content. The second-order level to the threshold is the ongoing activity of the unknowing.A first-order epistemology meets its boundary only by virtue of the loss of what is seen as its potential content. The unknown is assumed to be a specific content that is just like the known in every way except that has yet to be brought to light, discovered, or found. These metaphors work from the assumption that knowledge is somehow waiting "out there" to be had, and the protocols for knowledge production are thus geared towards the transformation of the unknown into the known, often with forceful manipulation and through maximization of control procedures. The unknown is precisely what needs to be minimized, and processes that generate unknowing are therefore seen as barriers to further knowing, leading only to confusion and unclarity. The unknown is valued only negatively, as the not-yet-known. The not-yet-known is pulled through from the other side of the threshold and brought "down" to re-instance the same reality that the epistemology already operates within, as further proof of its existence. The first-order epistemology focuses on the content of what it produces, and derives from this content the very justification for its truth; it invests its validity in its facts.
A second-order epistemology meets its boundary also by virtue of what is not known, but in addition it values the unknowing as an active and potentially transformative process. What for the first-order epistemology is only a potential new content is for the second-order epistemology a potential new way of being. This is a higher-order content, and is not simply "out there" to be discovered but must be enacted to exist; it must be brought into being. The unknowing is thus taken to be an invitation, a doorway, and instead of taking the unknown and making it known through the same epistemological patterns, it opens the door to more unknowing. Enacting a second-order epistemology is to allow one's way of knowing to change, not just the content of what is known. Unknowing is thus valued as a transformative agent, as a source of not only new knowledge but new ways of living forward. For a second-order epistemology, unknowing is a feature to be actively worked with, even developed, rather than a bug to be squashed. Said another way, a linear epistemology does not know that it does not know, while a recursive epistemology does, and makes of this something new of itself. The active incorporation of processes that yield states of unknowing is a primary way that a recursive epistemology self-calibrates.
Table 1. A comparison of the qualities of linear and recursive epistemologies.
Linear Episetmology
Recursive Epistemology
Non-self-reflexive
Self-reflexive
First-order
Second-order
Process kept independent of content
Process changes in response to content
Truth is objective and "out there"
Truth is a way of relating process and content
Content-focused
Process-focused
Validation reflected by its content
Validation as ongoing content-process recursions
Tends toward technical innovation
Can yield paradigmatic shifts
Knowledge produced as "pieces"
Knowledge produced as "wholes"
Unknown as potentially known content
Unknowing as potentially
transformative process
Observer split from environment
Observer and environment are mutually constituted in one process
#include<iostream.h>
class student
{
char name[10];
int rollno;
public:
void get()
{
cout<<"enter student's name"<<endl;
cin>>name;
cout<<"enter student's rollno"<<endl;
cin>>rollno;
}
void disp()
{
cout<<"Name of the student is : "<<name<<endl;
cout<<"Rollno is : "<<rollno<<endl;
}
};
class marks:public student
{
char subjectname[15];
int subcode,intmarks,extmarks;
public:
void get()
{
student::get();
cout<<"enter subject name";
cin>>subjectname;
cout<<"enter subject code";
cin>>subcode;
cout<<"enter Internal marks";
cin>>intmarks;
cout<<"enter External marks";
cin>>extmarks;
}
void disp()
{
student::disp();
cout<<"Subject name is : "<<subjectname<<endl;
cout<<"Subject code is : "<<subcode<<endl;
cout<<"Internal marks : "<<intmarks<<endl;
cout<<"External marks : "<<extmarks<<endl;
}
};
void main()
{
marks m;
m.get();
m.disp();
}
You have to correctly identify the type of data, for storage efficiency, but even more important, to have the required flexibility. For example, you may decide to store a telephone number as a number. Later you find out that this is an invitation to trouble: if you define it as a number, you can only store digits, but no hyphens, spaces, or parentheses. So, in this case, some kind of alphanumeric data type (text, string; names vary in different programming languages) is more appropriate.
You should give your variable names so that they can be recognized. In a quick exercise, you may work with 3 or 4 variables, so you won't notice the difference. But in a real-world program, you may have scores, or hundreds, of variables; program maintenance would be a nightmare if you can't figure out what several of the variables are used for.
You have to correctly identify the type of data, for storage efficiency, but even more important, to have the required flexibility. For example, you may decide to store a telephone number as a number. Later you find out that this is an invitation to trouble: if you define it as a number, you can only store digits, but no hyphens, spaces, or parentheses. So, in this case, some kind of alphanumeric data type (text, string; names vary in different programming languages) is more appropriate.
You should give your variable names so that they can be recognized. In a quick exercise, you may work with 3 or 4 variables, so you won't notice the difference. But in a real-world program, you may have scores, or hundreds, of variables; program maintenance would be a nightmare if you can't figure out what several of the variables are used for.
You have to correctly identify the type of data, for storage efficiency, but even more important, to have the required flexibility. For example, you may decide to store a telephone number as a number. Later you find out that this is an invitation to trouble: if you define it as a number, you can only store digits, but no hyphens, spaces, or parentheses. So, in this case, some kind of alphanumeric data type (text, string; names vary in different programming languages) is more appropriate.
You should give your variable names so that they can be recognized. In a quick exercise, you may work with 3 or 4 variables, so you won't notice the difference. But in a real-world program, you may have scores, or hundreds, of variables; program maintenance would be a nightmare if you can't figure out what several of the variables are used for.
You have to correctly identify the type of data, for storage efficiency, but even more important, to have the required flexibility. For example, you may decide to store a telephone number as a number. Later you find out that this is an invitation to trouble: if you define it as a number, you can only store digits, but no hyphens, spaces, or parentheses. So, in this case, some kind of alphanumeric data type (text, string; names vary in different programming languages) is more appropriate.
You should give your variable names so that they can be recognized. In a quick exercise, you may work with 3 or 4 variables, so you won't notice the difference. But in a real-world program, you may have scores, or hundreds, of variables; program maintenance would be a nightmare if you can't figure out what several of the variables are used for.
How do you solve this game show program in Linux by C plus plus language?
this the question:
Write a program that will simulate the following situation 10,000 times so we can decide the answer to:
Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which he knows has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice?
The pseudocode for this assignment would be:
Run a loop 10,000 times that:
After the loop is done, output a message that tells how many times the "prize door" was the "first choice" and how many times the "prize door" was the "second choice" so we can know what is the best choice.
The output of the homework should look like:
Number of times staying was the correct strategy: [NUMBER]
Number of times switching was the correct strategy: [NUMBER]
Therefore, the best thing to do is to [STRATEGY].
Would you Write c plus plus program using array for Fibonacci number?
You can write a C++ fib pro using arrays but the problem is the prog becomes very complicated since u need to pass the next adding value in an array.....
Can you have nested switch case statement in C?
If that's what you really want to do, the compiler will allow it. It might indicate an inefficient design, though.
Write a function to delete a specified node from linked list?
Presumably you have a situation like this:
Each node is an area in memory with (1) the address of the following node, (2) the address of the previous node, and (3) some more data.
Say the nodes are linked in alphabetical order and part of the list goes like this:
PrevNode
-> Data = "Cincinnati"
-> FrontPtr = address of "Cleveland"
-> BackPtr = address of "Amelia"
CurrNode
-> Data = "Cleveland"
-> FrontPtr = address of "Columbus"
-> BackPtr = address of "Cincinnati"
NextNode
-> Data = "Columbus"
-> FrontPtr = address of "Dayton"
-> BackPtr = address of "Cleveland"
...and you want to delete the middle one. Steps could be:
1. save the address of CurrNode as KillNode
2. copy CurrNode->FrontPtr (address of "Columbus") into
PrevNode->FrontPtr
3. copy CurrNode->BackPtr (address of "Cincinanti") into
NextNode->BackPtr
4. free up the space at the location named in KillNode
Can you create a list of famous people from wilmington N C?
Charlie Daniels, "The Devil Went Down to Georgia" Michael Jordan George "Meadowlark" Lemon, Harlem Globetrotter Trot Nixon, MLB Player, Boston Red Sox
What is a Pure Virtual Function Write a C plus plus program using Pure Virtual Function?
A pure-virtual method is similar to a virtual method. A virtual method is a method that is expected to be overridden in a derived class while a pure-virtual method must be overridden in a derived class. The base class may provide a default implementation for a pure-virtual method, but it is not a requirement, whereas it must provide an implementation for a virtual method. In addition,
any base class that has a pure-virtual method becomes abstract; you cannot instantiate abstract classes -- you are expectedto derive from them.
#include
class Abstract
{
public:
// Pure-virtual method; note the '=0' to denote pure-virtual.
virtual void Show()=0;
};
class Derived : public Abstract
{
public:
virtual void Show()
{
// Implementation is required here!
std:: cout << "Derived" << std::end;
}
};
void main()
{
// Abstract a; // Compiler error!
Derived d;
d.Show(); // Call pure-virtual method.
return( 0 );
}
#include<iostream>
#include<sstream>
using namespace std;
int main()
{
std::vector<int> input;
for (size_t index=0; index<4; ++index)
{
cout << "Enter a number: ";
bool valid=false;
while (!valid)
{
string in;
cin >> in;
stringstream ss;
ss << in;
if (!(valid = (ss >> input[loop]))
std::cout << "Invalid input! Try again: ";
}
}
std::cout << "\n\nYou entered the following: ";
for (size_t index=0; index<4; ++index)
cout << input[loop] << ' ';
cout << '\n' << endl;
}
How can you write your name on c plus plus turbo v3.0?
#include<iostream>
int main()
{
std::cout << "Your name";
}
Can we assign int and float values to the character data type in c language?
Yes, but this will result in an implicit conversion and possible narrowing. A char is always at least 8-bits in length, but an int may be 4 bytes in length (the actual length is implementation-defined) thus assigning an integer value outwith the range of a char will result in narrowing. Similarly when assigning a float (typically 16-bits in length); the fractional component will be lost and the integer value may be narrowed.
An unsigned char is only guaranteed to hold values in the range 0 through 255 and a signed char is only guaranteed to hold values in the range -127 through +127. Any values outwith those integer ranges may result in narrowing. Most modern architectures support twos-complement notation thus the signed range becomes -128 through +127, however this cannot be guaranteed across all implementations. Also, a "plain" char may be signed or unsigned depending on the implementation but is a distinct type from an explicitly signed or unsigned char. A plain char is only guaranteed to hold positive integer values in the range 0 through 127 across all implementations.
What notation does a condition statement use?
"if p then q" is denoted as p → q.
~p denotes negation of p.
So inverse of above statement is ~p → ~q, and contrapositive is ~q →~p.
˄ denotes 'and'
˅ denotes 'or'
What is reg52.h header in c language?
Not part of the standard C-library, so you have to contact its developer.
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int stack[10],n=0;
int fact(int);
int pop();
void push(int);
main()
{
int num;
printf("\n FACTORIAL USING STACK IMPLEMENTATED WITH ARRAY\n");
printf("\n Enter a number whose factorial is to be found(1-9): ");
scanf("%d",&num);
printf("\n The factorial is : %d",fact(num));
getch();
} void display()
{
int i;
printf("\n The stack is :\n");
for(i=1;i<=n;i++)
{
printf("%d\t",stack[i]);
}
}
int pop()
{ if(n==0)
{
printf("\n Stack empty!Pop not possible!");
exit(1);
}
else
{
int res=stack[n];
--n;
display();
return res;
}
} void push(int x)
{
if(n==9)
{
printf("\n Stack full!Push not possible");
exit(1);
}
else
{
n++;
stack[n]=x;
display();
}
}
int fact(int num)
{
if(num==2)
{
push(2);
push(1);
int res=1;
display();
while(n>=1)
res*=pop();
return res;
} else
{
push(num);
return fact(num-1);
}
}
What is random access mavhine?
The term "random access" is not normally applied to machines. It is normally used to refer to a form of data storage in which data on any part of the medium can be accessed in constant time.
Can you write a program for finding the prime factor using recursive function?
#include<stdio.h>
#include<conio.h>
void main()
{
int n=5,fact=1;
void fact();
printf("the value is %d",fact);
getch();
}
fact()
{
fact=fact(n)*fact(n-1);
return fact;
}
Where do c plus plus begin execution?
C++ begins its execution at int main(...parameters...) or int WINAPI WinMain(...parameters...). WinMain() is used in Win32 programming, for windows, message boxes etc. main() is used in console programming.
int main() either have no parameters ( int main()) or it can have two parameters ( int main(int argc, const char* argv[]) ). int argc is the argument count, and const char* argv[] is the argument vector (the values of the arguments). These parameters are only useful if you need to take arguments from the user when you start up the application.
int WINAPI WinMain() must have four parameters. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdParam, int nCmdShow). WINAPI is a method of passing parameters which comes from the days of Fortran and Pascal. It reverses the order the parameters are passed. Why this is necessary is not important WINAPI is simply required by Windows. HINSTANCE hInstance is a handle (a pointer) to the current application instance. HINSTANCE hPrevInstance is a handle to the previous instance. In theory, if there are multiple copies of an application open, then this would point to the last one created. LPSTR lpCmdParam is a long pointer to the command line calling existence to the application. If you were to open, let's say, "MyWin32App.exe" then this would be what lpCmdParam is pointing to. If you were to open "MyWin32App.exe -StartFullscreen" then that would be what it is pointing to. int nCmdShow is the parameter indicating how the window should be opened. You could start the application minimised, maximised etc.
References:
http://www.directxtutorial.com/Tutorial9/A-Win32/dx9A2.aspx
http://en.wikipedia.org/wiki/Main_function_(programming)#C_and_C.2B.2B
A recursive algorithm is an algorithm which calls itself with "smaller (or simpler)" input values, and which obtains the result for the current input by applying simple operations to the returned value for the smaller (or simpler) input.
Heres a recursive algorithm to reverse a string
char *rev(char str[],int pos1,int pos2)
{
if(pos1<pos2)
{
char temp=str[pos1];
str[pos1]=str[pos2];
str[pos2]=temp;
return rev(str,pos1+1,pos2-1);
}
return str;
}
You can call this function like this
char *r=rev("reverse it",0,9);