Sunday, August 2, 2009

I need the C code to read a BMP image..where can i gat it?

What is C code ?





I didn't hear about it ...





It is not Windows-Related Issue , Is it ?

redbud

What is a 'c' code for finding a factorial of a number using recursive functions?

int abc(int n) {


if(n==0) {


return 1;


} else {


return n*abc(n-1);


}


}


How do you embed standard C code in a C++ .NET app?

extern "C" {


/* C code */


}





(not just for MS tools, part of the C++ standard)


Why is this C++code wrong?

int main()


{


int x=10;


int y=20;


cout%26lt;%26lt;*(swap(x,y));


return 0;





}


int *swap(int x, static y)


{


int t=y;


y=x;


x=t;


return %26amp;y;


}


shouldn't it print 10 in the output?


when I compile it I recieve these errors and warnings:


error C2100: illegal indirection


error C2679: binary '%26lt;%26lt;' : no operator found which takes a right-hand operand of type 'void' (or there is no acceptable conversion)


warning C4042: 'y' : has bad storage class


warning C4172: returning address of local variable or temporary

Why is this C++code wrong?
This looks like an intentionally wrong program to test C++ knowledge. It doesn't make much sense, except perhaps help to understand C++ compiler errors.





Several things are wrong.


1) C4042 - Parameters of functions can't be "static" - "static y" doesn't make any sense - it should be juse "int y"





2) C4172 - you can't return address of local variable because by the time when execution of function swap() is finished, variable y no longer exists. Declaring it static is not going to help. Most sane compilers will ingore "static" here.





3) C2100 and C2679 errors are caused by the fact that function swap() is not know to the compiler at the point in source when it complies main().


It assumes that swap is defined as void function declared elsewhere, therefore you can't do * (dereference) on void and you cant feed it into cout.





If intention is to swap values of two variables in memory, the program would have to be re-written like this:








#include %26lt;iostream.h%26gt;





int* swap(int* x, int* y);





int main()


{


int x=10;


int y=20;


cout%26lt;%26lt;*swap(%26amp;x,%26amp;y);


return 0;





}


int* swap(int *x, int* y)


{


int t=*y;


*y=*x;


*x=t;


return y;


}
Reply:There is so much wrong with that code its beyond help. It looks like your using a lot of things you don't understand.





Go back to your C++ textbook, read it, and try again. More importantly stop trying to write fancy code you don't understand. It will get you no where.
Reply:Well, you got the errors. Did you write this? First, do you have a function prototype? Second, static y for your second parameter. What's the type? A parameter static doesn't really make sense. First, it doesn't have a type. It is also very bad form to return references to local types, which is what parameter is. If a parameter is a passed by reference, then you really don't need to return it. I am not entirely sure what this code is trying to accomplish.





Why all the pointers?





#include %26lt;iostream%26gt;





using namespace std;





int swap(int%26amp; x, int%26amp; y);





int main()


{


int x=10;


int y=20;


cout%26lt;%26lt; swap(x,y);


return 0;





}


int swap(int%26amp; x, int%26amp; y)


{


int t=y;


y=x;


x=t;


return y;


}
Reply:The main problem is in the swap function. 'static y' is a bad storage class. It needs to be an int, int* or int%26amp;.





swap substitutes one value for another, but why is it returning a ponter to just one value? Wouldn't the caller want both values? That's what the name swap implies.





void swap(int%26amp; x, int%26amp; y)


{


int t=y;


y=x;


x=t;


}





This modifies the actual integers that the caller passes in. So main would be:





int main()


{


int x=10;


int y=20;


swap(x, y);


cout%26lt;%26lt;"x is "%26lt;%26lt; x %26lt;%26lt;" y is "%26lt;%26lt; y;





return 0;





}





Passing by reference means that the function can modify the actual int that the caller passes in. If you pass by value (just int x, int y), then the function changes only it's local, temporary copy of the int. The caller's copy of the int is unaffected.





You could also pass int* instead of int%26amp;, but you're in C++, so you should use a reference.





Functions should never return a pointer to a local variable because that variable is temporary and will be gone as soon as the function returns. The caller will be left with a pointer to "nothing" (actually, some place in memory that should not be accessed). This is the reason for your last compiler warning.
Reply:You should use x and y in ur formal parameter.Try main() int x=20,y=10 cout%26lt;x'/t'%26lt;y; cout%26lt;'calling swap'; int swap(int %26amp;a,int %26amp;b) {int t=a;a=b;b=t; cout%26lt;/n%26lt;a%26lt;/t%26lt;b;} the punctuations are wrong but it is the right idea.


I need free c# code where i can find?

http://msdn2.microsoft.com/en-us/library...

I need free c# code where i can find?
you are better off learning c#. deploying copy and pasted code is a recipe for failure.

sundew

I need a C code fro the 2d game archanoid?

http://www.programacion.net/codigo/73/

I need a C code fro the 2d game archanoid?
thanks dude, ur simply great.................good work Report It



Below is my C++ code and question,but it cannot compiled.plz help me check this program?

A. Write a function that takes an array and its size as arguments, searches the array for the largest element, and sets that element to zero; the function should return the value that used to be in that spot (before it was set to zero).


B. In your main program, create an array of 20 integers, and give them all random positive values (in the range 1-100). Print out the contents of the array. Then, call the function you wrote in A ten times; print out the total of all the numbers returned by the function, and then print out the contents of the array again.





#include %26lt;iostream%26gt;


using namespace std;





int largestElement(int array[], int size)


{


int i;


int j;


int largest=0;





for(i=0;i%26lt;size-1;i++)


{


if (array[i]%26gt;largest)


{


largest = array[i];


}


}





for(j=0;j%26lt;size-1;j++)


{


if(array[j]==largest)


{


array[j]=0;


return largest;


}


}


}

Below is my C++ code and question,but it cannot compiled.plz help me check this program?
#include %26lt;time.h%26gt;


#include %26lt;iostream%26gt;


using namespace std;





int largestElement(int numbers[], int size)


{


 int largestNum = -1, largestIdx = 0;





 for(int i = 0; i %26lt; size; i++)


 {


  if(numbers[i] %26gt; largestNum)


  {


   largestIdx = i;


   largestNum = numbers[i];


  }


 }





 numbers[largestIdx] = 0;





 return largestNum;


}








int main(int argc, const char* argv[])


{


 int i, nums[20], sum = 0;





 srand((unsigned) time(NULL));





 for(i = 0; i %26lt; 20; i++)


 {


  nums[i] = 1 + rand() % 99;


  cout %26lt;%26lt; nums[i] %26lt;%26lt; " ";


 }





 for(i = 0; i %26lt; 10; i++)


 {


  sum += largestElement(nums, 20);


 }





 cout %26lt;%26lt; endl %26lt;%26lt; sum %26lt;%26lt; endl;


 for(i = 0; i %26lt; 20; i++)


 {


  cout %26lt;%26lt; nums[i] %26lt;%26lt; " ";


 }





 return 0;


}


What is a 'c' code for finding a factorial of a number using recursive functions?

int abc(int n) {


if(n==0) {


return 1;


} else {


return n*abc(n-1);


}


}





Got it(onlykeshu@yahoo.co.in)

What is a 'c' code for finding a factorial of a number using recursive functions?
# include%26lt;stdio.h%26gt;





void main()


{


int n,a;


printf("Enter the Number");


scanf("%d",%26amp;n);


a=fact(n)


printf("Factorial is -%d",a);


}


int fact(int f)


{


if(f==0)


{


f=0;


}


elseif(f==1)


{


f=1;


}


else


{


f=f*fact(n-1);


}


return f;


}


How to write C code to generate sine waves to TMS320C6711 DSP external DAC board?

Use the fact that binary numbers wrap around so for example let 256 be 360 degrees. and then use a 256 entry lookup table to generate the values for the DAC.





Then you need a timer interrupt to give you a time basis. So for example with a 1/8000 time interrupt.





Changing the step_size will control the frequency.





unsigned char frq_cnt;





void timer_int( void)


{


frq_cnt += step_size;





DAC = sine_table_lookup( frq_cnt);


}





You can use larger frq_cnt for higher resolution and still use just the top 8 or 10 bits of the frq_cnt value so that the lookup table does not become ridiculously large.

baby breath

How to test c# code?

I have an interview with microsoft and i need to be specific in my answers, plz help

How to test c# code?
Did you fall asleep in programming 101?


You use turbo c to write c code. what do you use to write java?

i want to learn java...i have the book but that's not enough. where can i get the compiler or something??

You use turbo c to write c code. what do you use to write java?
Go to http://java.sun.com/javase/downloads/ind... and download JDK 6 Update 3 with Java EE 5 SDK Update 3 and install it. That contains the Java compiler and interpreters. You might want to grab Crimson Editor to edit your code as well.
Reply:u can use textpad, netbeans, eclipse ect. install j2sdk first.
Reply:You can use several java programming languages, such as


-Cross-Platform Technologies


-Jini Network Technology


-Java EE


-Java ME


-Java SE


-Open Source


-XML/Web Services


http://java.sun.com/developer/codesample...
Reply:http://www.drjava.org








Edit:





You do need JRE 1.5 or higher. So to sun's website.
Reply:Well first of all you need the JDK to compile the java code. and as for writing the code, that can be done in notepad, if you have lots of experience in writing java, but i would recommend a IDE, check out jcreator.com or just google java IDE, most IDE for java is free. but its ur choice to use one.

yucca

How can i find a "number to text" source code for C language?

I have some code in vb but i couldn't convert it to c


thanks

How can i find a "number to text" source code for C language?
check out http://www.pscode.com
Reply:This would be very easy if you know programming in C. You have a complete logic written in VB try to convert one by one statement to C.





Need help doing so, I can help you out!
Reply:walmart


Is there any free tool to convert VB 6 code to C#? please suggest.?

s there any free tool to convert VB 6 code to C#? please suggest.

Is there any free tool to convert VB 6 code to C#? please suggest.?
That's silly. Any code for VB that is converted to C would require lots of redesign. Certainly, you would not make the new C code to use the VB objects. You would design it to use it's own libraries and such.





Good luck
Reply:there should be smth, if only u use .net teh


Java or C code for comparing/analyzing/matching sounds?

You need speed so you should use C.


This is C++ code it can complie i dont understand the problem?

#include%26lt;iostream%26gt;


#include%26lt;string%26gt;





struct company


{


string str;


int diameter;


double weight;


};


int main ()


{ using namespace std;


company pizza =


{


cout %26lt;%26lt; "Enter the name of the company:" endl;


getline(cin,str);


cout %26lt;%26lt; "Enter the diameter of the pizza: " ;


cin %26gt;%26gt; diameter %26gt;%26gt; endl;


cout %26lt;%26lt; "Enter the weight:";


cin %26gt;%26gt; weight %26gt;%26gt; endl;


return 0;


}


}

This is C++ code it can complie i dont understand the problem?
You said this code compiles? You must have one low quality compiler. No way does this code compile, as you have posted it anyway.





company pizza =


{


cout %26lt;%26lt; "Enter the name of the company:" endl;


getline(cin,str);


cout %26lt;%26lt; "Enter the diameter of the pizza: " ;


cin %26gt;%26gt; diameter %26gt;%26gt; endl;


cout %26lt;%26lt; "Enter the weight:";


cin %26gt;%26gt; weight %26gt;%26gt; endl;


return 0;


}





^^^ this is syntactic nonsense.
Reply:#include%26lt;iostream%26gt;


#include%26lt;string%26gt;





using namespace std;


struct company


{


string str;


int diameter;


double weight;


};


int main ()


{





company pizza;





cout %26lt;%26lt; "Enter the name of the company:" %26lt;%26lt; endl;


getline(cin,pizza.str);


cout %26lt;%26lt; "Enter the diameter of the pizza: " ;


cin %26gt;%26gt; pizza.diameter;


cout %26lt;%26lt; endl;


cout %26lt;%26lt; "Enter the weight:";


cin %26gt;%26gt; pizza.weight;


cout %26lt;%26lt; endl;


return 0;





}








You had a problem with the way that you setup and referenced your struct. I also moved the namespace.





Check out the following for more information: http://www.cprogramming.com/tutorial/les...

chrysanthemum

I want c++ code for saving an array of structure to a file and reading it back to the same array.?

does the write command redirect output to a file? instead of screen or printer?


I want C code to find the inverse of a given matrix?

adj(A)/|A|


Another way is to use Cayley Hamilton Theorem.


Please interpret c++ code; random number generator?

I am trying to generate a random number specifically in the range (-1, 1). I want to understand what the difference between the two lines below is; the first one gives me what I am looking for but i don't quite understand how it works. the second line does not work at all and I was wondering if anyone could suggest any alternatives. Thank you.





1. u = (2.0*rand()/RAND_MAX) - 1;


2. u = rand() / RAND_MAX ;

Please interpret c++ code; random number generator?
1. u = (2.0*rand()/RAND_MAX) - 1;





rand()/RAND_MAX





This gives you a number between [0,1]


Then you multiply by 2 and subtract 1.





You see:


2 * 1 = 2 , 2 -1 = 1 your max


2 * 0 = 0 , 0 -1 = -1 your min





2. u = rand() / RAND_MAX ;


This one only gives you values from 0 to 1
Reply:Some compilers could do rand()%3 - 2 but it's not guaranteed safe.





The following URL goes into a bit more detail: http://www.daniweb.com/forums/thread1769...
Reply:Hi,





Lets first look at the definition of the function rand():


int rand ( void );


Returns a pseudo-random integer number A in the range 0 to RAND_MAX or formally in the interval [0...RAND_MAX], A iselementof [0...RAND_MAX].





Lets first start with the second line of code, as this is the simplest one. The line u = rand() / RAND_MAX actually scales the generated number A=rand() so that it lies in the interval [0...1]. This can be seen as follows:


If A is the smallest number that can be generated by rand(), that is 0 then you have 0 / RAND_MAX = 0.


Likewise, if A is the largest number that can be generated by rand(), that is RAND_MAX then you have RAND_MAX / RAND_MAX = 1. In other words u iselementof [0/RAND_MAX...RAND_MAX/RAND_MAX] = [0...1].





The second line of code:


u = (2.0*rand()/RAND_MAX) - 1;





rand()/RAND_MAX generates a random number in the interval [0...1].





2*rand()/RAND_MAX generates a random number in the interval 2*[0...1] = [0...2].





2.0*rand()/RAND_MAX) - 1 generates a random number in the interval 2*[0...1] - 1 = [0...2] - 1 = [-1...1].
Reply:I think to answer your question then you have to understand what rand() is doing. The rand() function is returning a value between 0 and 1. This value can be multiplied against another value to give a desired random value within a range between 0 and that number. Why this works is beecause the decimal number you get out of rand(), when multiplied against a nubmer, is giving you a percentage of that number.





Remember that 100% is equal to 1 in decimal form. 50% is equal to .5 in decimal form. So if you want a random number between 0 and 100 and you multiple this percentage against it you will get a random number in that range. 100 * 1 = 100 ... 100 * .5 = 50





So with that in mind, now you should be able to understand what 2 * rand() is doing ... it gives you a random number between 2 and 0.





RAND_MAX is equal to 1, so that is doing nothing for you at all. You can forget about the divide by RAND_MAX. A number divided by 1 is itself.





The -1 is the key to getting the value in the range you want. if you take a random number between 0 and 2 and subtract 1 then you now have a random number between -1 and 1. (0 - 1 = -1 ... 2 - 1 = 1)





So really, the only thing you need is just the 2.0 * rand() - 1;


I want c# code to solve it in maps to get start&end of street layer and from any node get related edgs?

That's complex. May be you can contact a C# expert live at website like http://askexpert.info/

daffodil

Correct this c++ code?

void main(){


int x=5;


int y=0;


try{


cout%26lt;%26lt;x/y;


}


catch{


cout%26lt;%26lt;"cannot devide by zero";


}





}


//the problem is the catch block

Correct this c++ code?
try - C++ keyword that denotes an exception block (You had this correct)


catch - C++ keyword that "catches" exceptions (you needed to add the variable type parameter)


throw - C++ keyword that "throws" exceptions (You needed to put a throw statement in to activate if you were "dividing by zero"





EDIT: I initialized the divide variable to zero, the program works fine when I compile it, try re-building the solution, if it still doesn't work, I'd have to take a look at what compiler your using (which you didn't mention) to find out what the problem is. OR at least describe your error. Regardless I doubt your compiler would reject integer division, which is the only thing I could think of at the current time that would cause a crash, but I haven't used every compiler yet.





EDIT: I did a minor rewrite of the program, try it now.


#include %26lt;iostream%26gt;


using namespace std;


int main()


{


int x=5;


int y=0;


int divide;


try


{


x/y;


throw 1;


}


catch(int a)


{


cout%26lt;%26lt;"cannot devide by zero" %26lt;%26lt; endl;


system("pause");


return 1;


}


divide = x / y;


cout %26lt;%26lt; divide;


system("pause");


return 0;


}
Reply:I think you might try to put the paranthesis () at the end of the catch before braces{...}





Try it and have a good luck.
Reply:You need to tell C++ ,the type of exception that you want to catch. This is done as follows :


try{


/** Your try code block goes here */


}


catch(Exception e){


/** Your catch code block goes here */


}





Here Exception is the base exception class(superclass).





Try this, it should work.


In some C# code I was looking at I saw a "^" character. What does the ^ refer to?

Normally it is raise to a power. 5 squared is 5^2.

In some C# code I was looking at I saw a "^" character. What does the ^ refer to?
Normally this symbol is used for 'to the power of'.


For example 2^3=8





However, you should keep in mind that due to operator overloading in C#, this operator could have been used for literally anything.


I want c code for sudoku?

what's the grid?? send it to me at yunieandlenne @yahoo .co.uk sudoku, the best puzzle in the world, 347862915, lol

I want c code for sudoku?
How is it fun if you can cheat? Why don't you use your head and try to figure it out on your own...
Reply:BROTHER IF I KNEW THE CODE I WOULDNT BE SITTING HERE !!!!!!!!!!!


I WOULD HAVE BEEN SELECTED IN THE INDIAN SUDOKU TEAM!!!!!!!!!11


Write a c++ code to check wether a given number is odd or even?

AND the number with 0x1, if its true then its odd, if false, then even.

Write a c++ code to check wether a given number is odd or even?
Program that check whether a given number is odd or even:





#include%26lt;iostream.h%26gt;


#include%26lt;conio.h%26gt;


#include%26lt;stdio.h%26gt;


void main()


{


int i;


clrscr();


cout%26lt;%26lt;"Enter a Number :";


cin%26gt;%26gt;i;


if((i/2)==0)


{


cout%26lt;%26lt;"Its a even number";


}


else


{


cout%26lt;%26lt;"its a odd number";


}


getch();


}
Reply:The key is the modulo operator (%).





The following code will do:





#include %26lt;iostream%26gt;


using namespace std;


int main() {


int x;


cin %26gt;%26gt; x;


if(x%2) {


cout %26lt;%26lt; x %26lt;%26lt; " is odd";


} else {


cout %26lt;%26lt; x %26lt;%26lt; " is even";


}


return 0;


}
Reply:Using bitwise AND (%26amp;) is MUCH faster than division or modulus.





#include%26lt;iostream.h%26gt;


#include%26lt;conio.h%26gt;


#include%26lt;stdio.h%26gt;


void main()


{


int i;


clrscr();


cout%26lt;%26lt;"Enter a Number :";


cin%26gt;%26gt;i;


cout %26lt;%26lt; i %26lt;%26lt; " is an " %26lt;%26lt; (i%26amp;1) ? "odd" : "even" %26lt;%26lt; " number."


getch();


}
Reply:Check and see if the modulus of being divided by two is one or zero. If it is one it is odd, if it is zero it is even.
Reply:The above posters who mention bitwise AND have the most efficient/correct answer. Here's the corrected version for above poster's program.





#include %26lt;iostream%26gt;


using namespace std;





int main()


{


int i = 0;


cout %26lt;%26lt; "Enter a number: ";


cin %26gt;%26gt; i;


cout %26lt;%26lt; i %26lt;%26lt; " is an " %26lt;%26lt; (i%26amp;1) ? "odd" : "even" %26lt;%26lt; " number." %26lt;%26lt; endl;


return 0;


}





C++ has been revised in 99, hence the iostream, not iostream.h. All the standard functions are in the standard namespace. Hence using namespace std;. Main returns an int, so it's int main, not void main. Drop the conio.h, it's non-standard.

hyacinth

Write a C code to traverse a 2-dimensional array in spiral order?

http://www.openasthra.com/c-tidbits/prin...


I want image compression c code to run in TI / code composer studio. the program should be very simple. thanks

Simple to create or simple to use? Because it's not simple to create.


Write a C++ code for Mid point circle algorthim and mid point Ellipse algorthim?

http://www.programmersheaven.com/zone3/i...





http://www.planet-source-code.com/vb/def...





http://freeware.brothersoft.com/software...

Write a C++ code for Mid point circle algorthim and mid point Ellipse algorthim?
#include%26lt;iostream.h%26gt;


#include%26lt;graphics.h%26gt;


#include%26lt;math.h%26gt;


#include%26lt;conio.h%26gt;


#include%26lt;stdio.h%26gt;


#include%26lt;process.h%26gt;


#include %26lt;stdlib.h%26gt;


#include%26lt;dos.h%26gt;





int convertx(int k)


{


return(320+k);


}





int converty(int k)


{


return(240-k);


}





int convertxc(int k)


{


return(320+k);


}





int convertyc(int k)


{


return(240-k);


}





void axis();


int circlemid(int,int,int);


void plotpoint();





void main()


{


int gdriver=DETECT,gmode;


initgraph(%26amp;gdriver,%26amp;gmode,"c:\\tc1\\bgi"...


float xc,yc;


float r;


while(1)


{


cout%26lt;%26lt;"\n Enter The Center Of The Circle : ";


cin%26gt;%26gt;xc%26gt;%26gt;yc;


cout%26lt;%26lt;"\n Enter the Radius Of The Circle: ";


cin%26gt;%26gt;r;


circlemid(xc,yc,r);


cout%26lt;%26lt;"\n Do you want to continue ('y' or 'Y') : ";


char c;


c=getch();


if(c=='y' || c=='Y')


break;


}


}





void axis()


{


setcolor(1);


line(320,0,320,480);


line(0,240,640,240);


}





void plotpoint(int xc,int yc,int x1,int y1)


{


delay(50);


putpixel(convertxc(xc)+x1,convertyc(yc)+...


putpixel(convertxc(xc)-x1,convertyc(yc)+...


putpixel(convertxc(xc)+x1,convertyc(yc)-...


putpixel(convertxc(xc)-x1,convertyc(yc)-...





putpixel(convertxc(xc)+y1,convertyc(yc)+...


putpixel(convertxc(xc)-y1,convertyc(yc)+...


putpixel(convertxc(xc)+y1,convertyc(yc)-...


putpixel(convertxc(xc)-y1,convertyc(yc)-...


}





int circlemid(int xc,int yc,int r)


{


int x,y;


x=0;


y=r;


axis();


putpixel(convertxc(xc),convertyc(yc),5);


plotpoint(xc,yc,x,y);


double p=1-r;





while(x%26lt;y)


{


if(p%26lt;0)


{


x=x+1;


p=p+2*x+1;


}


else


{


x=x+1;


y=y-1;


p=p+2*(x-y)+1;


}


plotpoint(xc,yc,x,y);


}


return(0);


}





try to follow the code rules and try on your own for developing yous coding knowldge


Write a c++ code for an integer that displays the factorial of that number.?

int factorial (int num)


{


if (num==1)


return 1;


return factorial(num-1)*num; // recursive call


}








OR








#include %26lt;iostream.h%26gt;





int factorial(int);





void main(void) {


int number;





cout %26lt;%26lt; "Please enter a positive integer: ";


cin %26gt;%26gt; number;


if (number %26lt; 0)


cout %26lt;%26lt; "That is not a positive integer.\n";


else


cout %26lt;%26lt; number %26lt;%26lt; " factorial is: " %26lt;%26lt; factorial(number) %26lt;%26lt; endl;


}





int factorial(int number) {


int temp;





if(number %26lt;= 1) return 1;





temp = number * factorial(number - 1);


return temp;


}

Write a c++ code for an integer that displays the factorial of that number.?
Do your own homework.

poppy

What is the best way of sending the "enter" key manually, by code, in C?

I have a program that types in a custom-made code-defined "command" but I do not know how to have the code "press enter" after the command.





For related background, this is for terminal use:





Prompt) Enter a command


Prompt) exit.now //How to have the program press enter here is the issue.





In C++, I have seen that you can use sendkey(s), but how do you do it in C?





I had one idea that I could use fopen and fprintf with stdin.

What is the best way of sending the "enter" key manually, by code, in C?
Not exactly sure what you are asking, however,


ioctl() is the common method of setting up the terminal.


Are you writing a DOS program? Unix????


Is this a human interacting or a program interacting with another program?





if program to program, you can use piping
Reply:try appending "\r\n" to your command string.


Oop in c++ code.?

(6) Write a template function that sums two numbers, (passed as parameter) and returns the result. For character type however, the ‘Sum’ function shall display a message “Summation of characters is not supported”.

Oop in c++ code.?
If you have a go at it yourself and there is somewhere where you get stuck or you don't understand then ask again. The idea of homework is to get you to think about the subject.





So study c++ templating and have a go.


Can i put a C++ code to a MS-DOS batch code?

i will be using notepad for this

Can i put a C++ code to a MS-DOS batch code?
No its not possible..





but u can put perl, VBS, dos command in to windows scripting file..





Like a batchfile ..











Good luck
Reply:No. You would have to compile the C++ code and call the program from your batch file.
Reply:No, a batch file is really kind of like a shell script in linux. It just runs shell commands. If you want to program in C++ you will need a compiler.


I need c code to compress en uncompress rar files?

or for other good compres methods

I need c code to compress en uncompress rar files?
7-Zip is open source. Use it, or some other open source code that operates on .rar files.

cosmos

Whats the C++ code for finding the Prime numbers less than 50?

Search for the Sieve Algorithm on the Internet. It is very simple and used for benchmarking. Most examples are written in C, which will compile in C++.

Whats the C++ code for finding the Prime numbers less than 50?
the code below finds the prime numbers less than 50:





void FindPrimes()


{


bool bZeroReminder;





for(int nNumber=2;nNumber%26lt;50;nNumber++)


{


bZeroReminder=false;


for(int nLastNumber=2;nLastNumber%26lt;nNumber;nLastN...


{


if (0==(nNumber % nLastNumber))


{


bZeroReminder=true;


break;


}


}





if (!bZeroReminer)


{


/* Do the action. the nNumber contains a prime No. */


}


}


}
Reply:7!?


I want c# code to solve it in maps to get start&end of street layer and from any node get related edgs?

You should check out the c# code repository.





http://www.google.com/search?hl=en%26amp;q=c%2...


I need c++ code for number counter in procedural type?

i think you use a loop thats what we use on visual basic


Write a c code to display the following pattern?

1


2 3


4 5 6


7 8 9 10

Write a c code to display the following pattern?
Let’s index lines from 1 to N. In the n-th line, there are n elements ending to n(n+1)/2.


We can write a function PrintLine(int n) which prints the n-th line like:





void PrintLine(int n)


{


int last = n * (n + 1) / 2;





for (int k = 0; k %26lt; n; k++)


printf (“%d\t”, last – k);





printf (“\n”);


}





Now we can use PrintLine () in our main:





main()


{


int N;


printf (“Enter N: “);


scanf(“%d”, %26amp;N);





int n;


for (n = 1; n %26lt;= N; n++)


PrintLine (n);


}





--------------------------------------...


Oops! Correction: the for loop in PrintLine():





for (int k = 1; k %26lt;= n; k++)


printf (“%d\t”, last – n + k);
Reply:for(i=0;i%26lt;4;i++)


{


for(j=0;j%26lt;=i;j++)


print j+1


}


For getting project assignment there are better websites like http://getafreelnacer.com/
Reply:The absence of ellipsis (…) makes it too easy! Just use four printf (C) or cout %26lt;%26lt; … (C++) lines!
Reply:hint: use a loop
Reply:#include %26lt;stdio.h%26gt;





void main()


{


int temp=3;


for(int i = 1, j = 1; i %26lt;= 10; i++)


{


printf("%d ", i);


if(i==j)


{


printf("\n");


j = temp;


}


temp = i+j+1;


}


}
Reply:printf ("1\n2 3\n4 5 6\n7 8 9 10\n");





But thats not the answer you want.

online florists

Free exploit scanner needed that will generate exploit code in C or Perl?

I am interested at security/penetration for computers.Ok i have 3 questions...(and please dont call me a noob, i know that i am...)


1: I need a FREE exploit scanner that will work in Windows that will scan web servers and remote(not local)networks and computers for exploits. It would also be good if it could generate the code for the exploit in C or Perl.


2: I need to know how to hide my ip when exploiting. I think that there is a way that u can send exploits through wingates and/or shell accounts so that u can have anonymity. If someone could explain how to do this (or just tell me :) ) that would be appreciated.


3: I just got Backtrack 3 for Windows in the bootable cd and i can't surf the net in firefox. I would like to know how to configure backtrack to connect me to the internet(i just need to know how to connect).


THANKS!!

Free exploit scanner needed that will generate exploit code in C or Perl?
you need MBSA, metasploit, few tools from foundstone and perhaps few tools from the cd of CEH labs.
Reply:well.... hmm i know a good bruteforcer and hasher





www.oxid.it


Can someone give an example of a source code for C which shows the advantage of using pointers?

Im kinda a newbie in C... Why not rather use variables? Why there are some cases you need to use Pointers?


Please explain its advantage by giving an example of a code for it...


Thanks, I really need help... (^^,)

Can someone give an example of a source code for C which shows the advantage of using pointers?
Pointers have many advantages over normal variables. There are many senarios that require the use of pointer and not the normal variable. I won't give you a code coz it'll take up a lot of time and space, but i'll present some senarios.


1%26gt; let's say you want to return 3 diffrent variables from a function. a function can only return only one variable. so, to do this you have to send pointers of three variables to the function as paramater. if you send them as plain vars then the values chaged inside a function gets lost when the function returns.


2%26gt; you can use pointers when you need to manipulate different memory locations through same variable.


3%26gt; you can have pointers that points to a function instead of a variable. these are very useful when designing graphic user interface (GUI).


4%26gt; when you need to allocate momory during runtime, by using malloc() or calloc(), you must do it through pointers.


5%26gt; another important use of pointer is that, if your program requires very large amount of memory, then you have to allocate memory from heap memory instead of stack memory. this also requires dynamic memory allocation through pointers.





Note: since you're a beginner in c programming, you might not understand everything i talked about above. don't worry. continue using simple variables where you can. pointers can give you a lot of trouble if you're inexperienced. as you go on programming you'll encounter situations where you know you have to use pointers. for now, just understand what they are, and don't get too eager to use them. there will be a time when you can't work without them. trust me ;)
Reply:i see your e-mail is listed in your profile. so if got some time i will send you some examples, but you might have to wait for a while. Report It

Reply:Here you go:





#include "stdio.h"





void main()


{


printf( "A pointer can be allocated dynamically." ) ;


printf( "A pointer can be deallocated dynamically !" ) ;


printf( "A pointer can be set to NULL" ) ;


printf( "A pointer can be used to point to different objects." ) ;


printf( "A pointer supports pointer arithmetic." ) ;


printf( "A pointer makes it possible to have a concept like void*" ) ;


printf( "A pointer can even point to a function !!" ) ;


printf( "The previous point allows us to implement polymorphism in C although language doesn't support it." ) ;


printf( "A pointer must be used if a change in function param's has to be reflected in caller function." ) ;


printf( "\n" ) ;


printf( "Without pointers we're lost." ) ;


printf( "Thank you for your time. Please ask more questions if you need examples for each one of these advantage." ) ;


}


Help getting my code C++ code to replace a value.?

What i want is, each time I run my void rotate(...) function, i want the function to do the calculations and replace the coordinates of the point. I subplemented the constants 6,6 for dx,dy and it appears that the function isnt replacing the values at all. How do i get the program to replace my co-ordinates?





{


double new_x = (((p.get_x()*cos(angle))+(p.get_y()*sin(...


double new_y = (((-(p.get_x())*sin(angle))+(p.get_y()*c...


double dx = p.get_x()- new_x;


double dy = p.get_y()- new_y;


p.move(dx,dy);


}


...


int main()


{





cout%26lt;%26lt; "The original point p (5,5) rotated 5 times by 10 degrees then scaled 5 times by .95 is:""\n";


Point p(5,5);


double angle = 10;


double scale = .95;


int rotation_count = 0;


int scale_count = 0;





while (rotation_count%26lt;5)


{


rotate( p, angle);


cout%26lt;%26lt; "The point is now " %26lt;%26lt; p.get_x() %26lt;%26lt; "," %26lt;%26lt; p.get_x()%26lt;%26lt; "\n";


rotation_count++;


}


return 0;


}

Help getting my code C++ code to replace a value.?
The Yahoo editor chopped off a lot of your code. Break up the lines so it doesn't truncate them to "...".





Since it is impossible to tell, are you sure you are passing your variables by reference rather than value?





---EDIT---





Saw this on one of your other submissions:





void rotate(Point p, double angle)





It should be





void rotate(Point%26amp; p, double angle)








---EDIT 2---





You changed the line? Your original code had





cout%26lt;%26lt; "The point is now " %26lt;%26lt; p.get_x() %26lt;%26lt; "," %26lt;%26lt; p.get_x()%26lt;%26lt; "\n";





which should be ok. But it looks as if your error message is complaining about line 50 :





cout%26lt;%26lt; "The point is now " %26lt;%26lt; p.get_x %26lt;%26lt; "," %26lt;%26lt; p.get_x %26lt;%26lt; "\n";





Make it p.get_x() and p.get_y(). The lack of parens for the function call is probably causing your error. It almost looks as if you are confusing c++ and C#. Something like p.get_x would be a property in C#.
Reply:You deserve better than a "C++" for all that work, looks more like an A++ to me...


You do have crappy sentance structure however!?!?!?


Write c code to print following?

1


0 1


0 1 0


1 0 1 0

Write c code to print following?
printf("1\n");


.


.
Reply:printf("1\n0 1\n0 1 0\n1 0 1 0");

flowers uk

Need another C or C++ code for...?

a simple structure named Students. This structure consists of three variables Name, GPA and TotalMarks. Now write three variables of data type Students. Get value from user for these three students and show them on screen.

Need another C or C++ code for...?
If I understand your question correctly this is


what you're looking for. =) Enjoy


%26lt;3





- Hex





#include %26lt;iostream%26gt;


#include %26lt;string%26gt;


#include %26lt;conio.h%26gt; // For getch(); function





using namespace std;








int main()


{


struct Students


{


string Name;


char GPA[5];


char TotalMarks[5];


};








Students ST1;


cout %26lt;%26lt; "Student 1\n"


%26lt;%26lt; "Name: ";


getline(cin, ST1.Name);





cout %26lt;%26lt; "GPA: ";


cin.getline(ST1.GPA, 5);





cout %26lt;%26lt; "TotalMarks: ";


cin.getline(ST1.TotalMarks, 5);








Students ST2;


cout %26lt;%26lt; "\n\nStudent 2\n"


%26lt;%26lt; "Name: ";


getline(cin, ST2.Name);





cout %26lt;%26lt; "GPA: ";


cin.getline(ST2.GPA, 5);





cout %26lt;%26lt; "TotalMarks: ";


cin.getline(ST2.TotalMarks, 5);








Students ST3;


cout %26lt;%26lt; "\n\nStudent 3\n"


%26lt;%26lt; "Name: ";


getline(cin, ST3.Name);





cout %26lt;%26lt; "GPA: ";


cin.getline(ST3.GPA, 5);





cout %26lt;%26lt; "TotalMarks: ";


cin.getline(ST3.TotalMarks, 5);











cout %26lt;%26lt; "\n\n\t::Student Records:::\n"


%26lt;%26lt; "[Student - 1]\n"


%26lt;%26lt; "Name: " %26lt;%26lt; ST1.Name %26lt;%26lt; endl


%26lt;%26lt; "GPA: " %26lt;%26lt; ST1.GPA %26lt;%26lt; endl


%26lt;%26lt; "Total Marks: " %26lt;%26lt; ST1.TotalMarks





%26lt;%26lt; "\n\n[Student - 2]\n"


%26lt;%26lt; "Name: " %26lt;%26lt; ST2.Name %26lt;%26lt; endl


%26lt;%26lt; "GPA: " %26lt;%26lt; ST2.GPA %26lt;%26lt; endl


%26lt;%26lt; "Total Marks: " %26lt;%26lt; ST2.TotalMarks








%26lt;%26lt; "\n\n[Student - 3]\n"


%26lt;%26lt; "Name: " %26lt;%26lt; ST3.Name %26lt;%26lt; endl


%26lt;%26lt; "GPA: " %26lt;%26lt; ST3.GPA %26lt;%26lt; endl


%26lt;%26lt; "Total Marks: " %26lt;%26lt; ST3.TotalMarks;





getch();


}
Reply:Why don't you do your own homework? It's very educational, and (in this case) fun!


How to convert C code to Java code?Is there any editor/tool for that?

I've never been really great with either language, but googling "convert c to java" gives a BUNCH of results on how to do it. If you can do it manually, you can most likely find a program to do it. Click the link below for google results...

How to convert C code to Java code?Is there any editor/tool for that?
http://www.planetsourcecode.com/vb/scrip...





http://www.planetsourcecode.com/vb/scrip...





http://www.planetsourcecode.com/vb/scrip...


Who knows where can i find a deadlock simulator code for C++ ?

i wanna study deadlock simulator in c++ , i want its code and its algorithm , who knows where i can find the code and resources ?

Who knows where can i find a deadlock simulator code for C++ ?
You too Lazy to be a programmer .


http://en.wikipedia.org/wiki/Dining_phil...
Reply:try to go to www.planetsourcecode.com and find what code you want.....i think thats hard to find and if you want to know about deadlock id rather suggest that you should surf the web....there are many of them in the web....


A c++ code that generate factorial of any number?

oh the very first recursive example =)...lets see





int factorial(int number) {





if(number %26lt;= 1) return 1;





return number * factorial(number - 1);





}

hamper

Write c code for folliwing on the center of screen?

1


1 2 1


1 2 3 2 1


1 2 3 4 3 2 1

Write c code for folliwing on the center of screen?
There are many ways to do this. I don't want to do your homework for you, but this (untested) code should get you started.





int min, max,


min = 1;


max = 4;





for (int i = min; i %26lt;= max; i++) {


for (int j = min; j %26lt;= i; j++) {


cout %26lt;%26lt; j;


}


for (int k = i; k %26gt;= min; k--) {


cout %26lt;%26lt; k;


}


cout %26lt;%26lt; "\n";


}


A c++ code that generate a student grade using switch method?

#include %26lt;iostream%26gt;


using namespace std;





int main()


{


char test;





cout %26lt;%26lt; "enter grade";


cin %26gt;%26gt; grade;








switch ( grade ) {





case 50 :





cout %26lt;%26lt; "You Failed";





case 60 :





cout %26lt;%26lt; "You Just made it";





case 70:





cout %26lt;%26lt; "You passed";





case 80:





cout %26lt;%26lt; "good job";





case 90:


cout %26lt;%26lt; "wow a 90";





case 100:


cout %26lt;%26lt; "way to go you got a 100";





default :


// Process for all other cases.








}





}





you should be able to work off this if i am understanding your question correctly

A c++ code that generate a student grade using switch method?
Most grading systems are like this: 65 and lower: F, 70-75: D, 75-80-C, etc.... Notice it's all 5 units apart, and the grades are from 0 to 100. So take the grade and divide it by 5. Now your result is between 0 and 20. 20 is an A+, 19 is an A, 18 is a B+, etc... I think you can see how this could easily be a switch statement.


A c code that allows one to enter scores for 10 subjects for each student then compute & display average?

without cheating on your homework you should use the following elements:





stdio.h


printf()/scanf()


an array to store the scores


a loop that loops over the array (10 times)

A c code that allows one to enter scores for 10 subjects for each student then compute %26amp; display average?
Do you want it for an assignment?


Using C# code how can I get the all curren running applications ( not proccesses ) thanx in advance .?

using System.Diagnostics;





Process[] myProcesses = Process.GetProcesses();





for(int i=0;i%26lt;myProcesses.Length;i++)


{


Console.WriteLine ( myProcesses[i].MainWindowTitle );


}

bloom