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 do you downgrade from 4.01 to 1.5?

Warning! Before you start, make sure that you are willing to take a chance at completely locking up your PSP and making it un-usable...HOW TO MAKE A PANDORA'S BATTERY TO DOWNGRADE YOUR PSP

REQUIREMENTS :

1) A spare PSP battery (recommended) , any make will do .

2) A spare memory stick PRO DUO (it has to be PRO DUO)

3) A PSP with Custom firmware ( OE or M33) or a 1.5 PSP. Ask you friends , search for one

INSTALLATION :

1) Take out the 1.5 or Custom PSP ( OE or M33) and put in the spare memorystick (it has to be pro duo) and spare battery that you wanna modify .

2)Now you gotta format the memory stick . Scroll to SETTINGS > SYSTEM SETTINGS > FORMAT MEMORY STICK

3) OK now download this pack from http://igizmore.blogspot.com/2007/08/mak...tery-magic.HTML . and EXTRACT it with WinRAR . Don't have Winrar Download it from www.winrar.com

4) Now extract the PANDORA folder from the downloaded pack to the desktop . Inside the Pandora folder you will find two other folders "msinst" and "mspformat"

5) Connect you PSP to the PC via USB cable .

6) Now in you computer go to START > RUN and type in CMD and click on OK . A black box will popout .

7) Here's kinda the confusing part . your computer might show C:\ or C:\Documents and Setting\Username> … Now I told you to you to extract the folders to the Desktop . So copy the location of the msformat picture here paste it followed by the drive letter of your PSP (eg my psp drive removable disk (I the letter is I )

Now if your PC shows C:/ in your CMD copy the address bar and paste it in followed by the letter of your psp drive .

C:\Documents and Settings\username\Desktop\PANDORA\mspformat\mspformat.exe I

IF you PC shows C:\Documents and Setting\Username> copy the address bar and paste it in followed by the letter of your psp drive

C:\Documents and Setting\Username>\PANDORA\mspformat\mspformat.exe I

8) Keep trying till you get this prompt (like mine) :

>>> C:\Documents and Setting\Username>Desktop\PANDORA\mspformat\mspformat.exe I

>>> You are about to format the drive I .

>>> All Data will be lost . Do you want to continue? [Y]

Then you type in y and you will see

>>> Drive successfully formatted, and partition moved.

After that you can close the CMD box

9) Disconnect your psp from the PC and remove the memory card and turn of the PSP , then place the MS (MS=memory stick) back in and turn the PSP on . Then reconnect you PSP to the PC . NOTE: You have to do this …

10) Now download this pack from http://igizmore.blogspot.com/2007/08/mak...tery-magic.HTML , extract it with WinRar and copy the PSP folder and the UPDATE.PBP to the ROOT of the PSP memory stick . If you you have a 1.5 PSP no problem , If you have Custom Firmware make sure you turn on the 1.5 kernel mode .

11) Disconnect your PSP . Scroll to GAME and click on "Pandora's Battery Firm. Installer" it will take a few moments . After its done remove the MS from the PSP turn it off then place it back in and turn the PSP back on again, you HAVE to do this .

12) Connect your PSP to the PC . A Few files and folders will be formed in your ROOT , now copy the msipl.bin from the root to the "msinst Folder" which is inside your extracted Pandora folder . It should look like this

13) Here we go again START >RUN type in CMD . That black box will open again . Now copy the address of the msinst.exe followed by the PSP drive letter followed by the address of the msipl.bin

Now if your PC shows C:/ in your CMD it should be something like this (with reference to PSP's drive as I)

C:\Documents and Settings\username\Desktop\PANDORA\msinst\msinst.exe I Documents and Settings\username\Desktop\PANDORA\msinst\msipl.bin

IF you PC shows C:\Documents and Setting\Username> then it will look something like this :

C:\Documents and Settings\username>Desktop\PANDORA\msinst\msinst.exe I Desktop\PANDORA\msinst\msipl.bin

If you did it right you will get a prompt like (this promp will differ from PC to PC) :

>>> PSP MS IPL Installer

>>> Load IPL code msipl.bin

>>> 241664 bytes(59 block) readed

>>> Target DRIVE is 1

>>> Check partation Sector

>>> boot status 0x80

>>> start head 0x0B

>>> start sec/cyl 0x0018

>>> partation type 0x06

>>> last head 0x7F

>>> last sec/cyl 0xCFE0

>>> abs sector 0x00000177

>>> ttl sector 0x0003CF689

>>> signature 0xAA55

>>> Check BPB Sector

>>> signature AA55

>>> Check free reserved sector:OK

>>> Write ABS Sector 0x10 to 0x1E7

>>> Are You Sure ?[Y]

Type in Y and you will get

>>> Write MS BOOT CODE

Congrats you now have a Magic Memory stick . Now Disconnect your psp from the PC and remove the memory card and turn of the PSP , then place the MS back in and turn the PSP on .

NOTE : if you get

>>> PSP MS IPL Installer

>>> Load IPL code msipl.bin

>>>Can't open msipl.bin

The location (address) of the msipl.bin is WRONG (i got this like loads of times until I figured it out just keep trying )

14) After you have the magic MS leave it in the PSP then , Turn on your psp and go to Pandora's battery Creator , make sure you have the spare battery in it . I Recommend backing up so you can make the Pandora battery into a normal one press "triangle " first it will back up then go to "Pandora's battery Creator" again and press X … You normal spare battery is now a … PANDORA UNBRICKING BATTERY … WOO HOO… You did it .

NOTE :when the Pandora's battery Creator loads and if you get "ERROR at address 0x27" or a similar error you are screwed , you cant turn that battery into a Pandora battery but you can use it as a normal battery . Use another battery and try again . How do I know this ??? coz I got screwed too : P .

TO DOWNGRADE UNBRICK ANY PSP or to make your modded battery and MS to normal SEE http://igizmore.blogspot.com/2007/08/pan...ck-any-psp.HTML

CREDITS : ALL this is thanks to the Noobz! team ... Please donate to them for all the hard work the put in . visit their site www.noobz.eu

Some Video Links -http://au.youtube.com/watch?v=Chr5JdhFHXA (Making the Magic Mem stick)

http://au.youtube.com/watch?v=CPMRuqLuJsI (Making the battery)

Help from Afterdawn Forums and YouTube.

Shell program to find out whether given number is Avogadro or not?

echo "Enter A Number :"

read n

r=n

s=0

rem=0

while [ $n -gt 0 ]

do

rem=$(($n%10))

s=$(($s+$rem*$rem*$rem))

n=$(($n/10))

done

if [ $r -eq $s ]

then

echo "The Number is Avogadro"

else

echo "The Number is Not Avogadro"

fi

Algorithm for finding GCD and LCM of two given numbers?

As written in the c programming language to find the LCM for up to 50 numbers. All that needs to be done is compile this. It is my first draft of the program, as it was due for a class 2 hrs ago, but if you wish to try and optimize it, that's your task.

-----------------------------------------------------------------------------------------------------------

#include <stdio.h>

#define NUMFACT 50

void FindFactor(int[]);

int Min(int[]);

int Max(int[]);

int calc(int[]);

int check(int[]);

void bubbleSort(int[]);

void Display(int[],int);

int main()

{

int factors[NUMFACT] = {0}; //FACTORS ARRAY INITIALIZED WITH 0'S

int lcf; //LOWEST COMMON FACTOR

FindFactor(factors);

lcf = calc(factors);

bubbleSort(factors);

Display(factors, lcf);

return(0);

}

void FindFactor(int factors[])

{

int tempvalue; //TEMP VALUE TO BE STORED IN FACTOR ARRAY

int location = 0; //LOCATION IN VECTOR TO PLACE INPUT NUMBER

do

{

printf("Enter factor: ");

scanf("%d",&tempvalue);

if (tempvalue != -1)

{

factors[location] = tempvalue;

}

++location;

} while (tempvalue != -1 && location <=49);

}

int Min(int factors[])

{

int increment; //INCREMENT EACH PASS

int min = Max(factors); //MAX VALUE IN FACTORS CHANGED TO LOWEST

int location; //LOCATION OF THE MIN VALUE IN ARRAY

for(increment = 0 ; increment < 49 ; increment++)

{

if (factors[increment] != 0)

{

if(factors[increment] < min)

{

min = factors[increment];

}

}

}

for(increment = 0 ; increment < 49 ; increment++)

{

if(min 0);

lcf = copyfactors[0];

return(lcf);

}

int check(int factors[])

{

int increment; // INCREMENT EACH PASS

int value = 1; //TRUE VALUE RETURNED IF IF-LOOP IS ALWAYS FALSE

for(increment = 1 ; increment < 49 ; increment++)

{

if (factors[increment] != 0)

{

if (factors[increment-1] != factors[increment])

{

value = 0;

}

}

}

return(value);

}

int Max(int factors[])

{

int max = 0; //START VALUE SINCE # CAN'T BE LESS THAN 0

int increment; //INCREMENT EACH PASS

for(increment = 0 ; increment < 50 ; increment++)

{

if (factors[increment] > max)

{

max = factors[increment];

}

}

return(max);

}

void bubbleSort(int factors[])

{

int numPasses; //LCV THAT CONTROLS # OF PASSES

int lcv; //LOOP CONTROL VARIABLE FOR SORTING

int temp; //HOLDS VALUE DURING SWAP

for(numPasses = 1; numPasses < NUMFACT ; numPasses++)

{

for(lcv = 0 ; lcv < NUMFACT - numPasses ; lcv++)

{

if(factors[lcv] > factors[lcv+1])

{

temp = factors[lcv];

factors[lcv] = factors[lcv+1];

factors[lcv+1] = temp;

}

}

}

}

void Display(int factors[],int lcf)

{

int increment; //INCREMENT EACH PASS

printf("The factors of %d are:",lcf);

for(increment = 0; increment < 50 ; increment++)

{

if(factors[increment] != 0)

{

printf(" %d",factors[increment]);

}

}

printf("\n");

}

Write a flow chart that will take an input a number x from a user and output e raised to the power x?

...

#include <math.h>

...

double x;

...

cout << "Enter x: ";

cin >> x;

cout << "Result is: " << exp(x);

...

What are interrupters?

An interrupt is a hardware-generated change of flow within the system. An interrupt handler deals with the cause of the interrupt. Control is then returned to the interrupted context An interrupt is a hardware-generated change of flow within the system. An interrupt handler deals with the cause of the interrupt. Control is then returned to the interrupted context

What is advantage of using Object oriented Concept?

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 the difference between do while and for loop?

do

{

//statements

}while(condition);

The statements inside the block get executed at-least once, no matter what condition you have placed. Only from the 2nd time the condition is checked, simply because the condition is at the last.

for(initialization; condition; updation)

{

//statements

}

Here the statements don't get executed even once if the condition fails initially. The condition is at the entry itself.

C program for exponential series?

exponential series

#include<stdio.h>

#include<conio.h>

#include<math.h>

void main()

{

int i,x,n;

float e=1,denominator=1;

clrscr();

printf("Enter the value of x,n\n");

scanf("%d,%d",&x,&n);

while(i<=n)

{

e+=(float)(pow(x,i)/denominator);

denominator*=i;

++i;

}

printf("answer is %f",e);

}

How do you make mobile application with VB.NET?

You would have to use a version of Visual Studio that can target the .Net Compact Framework. Be aware that the Compact Framework is a SUBset of the .Net Framework, so there will be some missing classes and methods.

A c program of matchstick game?

#include

#include

void main()

{

int matc=21,x,y;

char ch;

clrscr();

printf(" WELCOME TO THE WORLD OF GAMING \n");

printf("");

printf(" MATCH STICK GAME \n");

printf("/n");

printf("PRESS ANY KET TO KNOW THE RULES \n");

scanf("%c",&ch);

printf("This is a game between user and computer \n There are 21 match sticks user have to pick

1,2,3 or 4 match stick in one turn \n One who pick up the last match stick loose the game \n");

printf(" number above 4 is invalid \n");

printf("if u do this computer automatically wins");

printf("ALL THE BEST \n");

for(int i=1;i<=4;i++)

{

printf("pick up the match sticks 1-4 \n");

scanf("%d",&x);

y=5-x;

printf("i have pick up %d \n",y);

matc=matc-(x+y);

printf("the remaining match stick is %d \n",matc);

if(matc==1x>4)

break;

}

if(matc==1)

{

printf(" your turn pick up the last one \n");

scanf("%d",&x);

printf("you loose");

printf("MUMMY KO BOLO COMPLAIN PILAYE \n");

printf("\t THANKS \n");

}

else

{

printf("you loose because of abiding rules");

getch();

}

What is the difference between preprocessor and macros?

Macros, which are special lines/fragments of code, differ from any other code written in the source files in the aspect that it's not passed to the compiler (either for the purpose of encoding into machine instructions, or some intermediate form instructions). Instead, macros perform textual manipulations on the source code before passing it to the compiler, where this process preliminary to compiling the source files is called "preprocessing", and the software component responsible of doing it is called the "preprocessor"

Preprocessors, statements that tell the programming language (c or c plus plus) to perform such task as combining source program files prior to compilation.

by Abrar .s. Hussain

Email for correction: hussainabrar46@gmail.com

What is Data level structure?

three levels of data abstraction

are:

1. Physical level : how the data is

stored physically and where it is

stored in

database.

2. Logical level : what information

or data is stored in the database

(like what is the

datatype or what is format of

data.

3.View level : end users work on

view level. if any amendment is

made it can be

saved by other name.

for the database to be usable it

must retrieve data efficently.this

efficency led designer to use

complex data structure in the

database

Program to find the largest of four numbers using nested if?

#include<stdio.h>

#include<conio.h>

void main()

{

int a,b,c,d,e;

clrscr();

if(a>b)

{

if(a>c)

e=a;

else

e=c;

}

else

{

if(b>c)

e=b;

else

e=c;

}

if(e>d)

printf("%d is the greatset",e);

else

printf("%d is the greatest",d);

getch();

}

Least common multiple in C programming?

The following code for example is a solution (you could do it with less variables, but this is more readable):
int GCD(int a, int b){
int n, k, c;
n = (a>b)?a:b;
k = (a>b)?b:a;
while (k){
c = n%k;
n=k;
k=c;
}
return n;
}

How does a function know which value to attach to which parameter?

Because of the function declaration and definition (which must match)

When you define the function:

void msgBox(int x, int y, char *message);

you have to pass it parameters in the order they were defined:

void main()

{

msgBox(5,10,"Hello World");

}

If you present the values in the wrong order, it will either not compile (type mismatch), or the function will behave unexpectedly (for instance, x and y coordinates swapped).

How does the CPU differentiate between command and data?

In general the only difference between commands, or instructions, and data is the context in which each appears. If the CPU is fetching the contents of memory to get the next instruction, then it assumes that the Program Counter register points to commands. If the CPU is executing an instruction that needs to fetch data from memory, the data at the address specified by the instruction are fetched, assuming that the address points to data.

This is what allows a program to be loaded into memory in the first place; the part of the operation system responsible for this operation treats the program as data, loading it into memory as instructed in the file. Then the OS branches to a specified place within that memory and begins fetching instructions there.

This blurring between instructions and data has also been used in the past to allow a program to modify itself as it executes. This is usually considered poor practice; some operating systems, such as HP's OpenVMS, even set up memory page protections to keep this from happening.

How are coupling and cohesion related to modular design?

Ideally, modules will have low coupling and high cohesion. Coupling describes the strength of the connection between modules in a program. Loose (or low) coupling occurs when modules do not depend on other modules. One way to control this is by avoiding the use of global variables and reducing the number of variables that are passed between the modules. Another is to limit the depth of module calls (where a module calls another module, that then calls another module, and so on). Cohesion is a measure of how well a module accomplishes the module's purpose. High cohesion implies that all the module's internal statements serve to perform the module's (single) task. In order for modules to work together, there must be some connection between them. The nature of the connection is important because it determines the extent to which the modules are coupled. How are they connected? The best way to connect them is to pass the value of a local variable in one module to a second module through its parameter list. (A local variable is a variable that is defined within a module (not a parameter) is local to that module. The values of local variables are not available outside of the module in which they are declared unless they are passed. Local variables are reset to their default values once control leaves the module in which they are declared.) Another way to share information is through the use of global variables. (A variable that is defined outside of a module and that does not need to be passed to a module to be accessed by it is a global variable. Global variables retain their value once control leaves the module in which they are referenced. ) Because the value of a global variable can be changed by any module without passing, it increases the coupling between modules.

Many languages distinguish between uppercase and lowecase letters in user-defined names what are the pros and cons of this design decision?

In computer programming, many languages distinguish between uppercase and lowercase letters in user defined variables. This is an advantage because it allows users to tell the difference between variables based on whether they are uppercase or not. It is a disadvantage because forgetting to change a letter to the proper case will result in an error when the program runs.

What is ipr?

IPR is an acronym that stands for many things. Some of them are Intellectual Property Rights, Industrial Property Rights, and Institute of Public Relations. It also stands for Injection Pressure Regulator, Interim Progress Review, and International Paranormal Research.

Function of GoTOXY?

Gotoxy is used to move the cursor on the monitor screen. Gotoxy follows a certain programming code to put the cursor in the desired position.

Why you have to put empty parathensis after main function?

Empty parenthesis is a self invoked function that is executed immediately after its created. IT makes the function an expression and any subsequent function, the call.