Monday, May 24, 2010

Will C# programming language replace C++ language definitively one day ?

I want to know: Will (C++) persist as a language of its own tasks ? or: Will (C++) perish and disappear one day and be replaced definitively by (C#) ?

Will C# programming language replace C++ language definitively one day ?
thats depeneds on Companies what they use more now
Reply:No languages last forever. Personally, I detest all forms of C because of its weak typing and its tendency to be excessively cryptic. Using languages in the Ada, Pascal, and BASIC arena is actually faster when you have to pick up someone else's code. C allows people to commit programming atrocities that should merit summary execution.





Ada and Pascal, with stronger typing, tend to have much better error filtering. If you get your code past Ada's picky compiler, you know you've got half the battle won right there. BASIC, with simpler syntax, tends to be easier to decipher. Original authorship in a language such as C is what it is, but as a maintainer (among other duties), I would never write in C variants unless forced to do so. It is just too unkind to those who follow in my footsteps.





Just one man's opinion, of course.
Reply:Absolutely not. The chief advantage of C# is its integration into the .Net development suite. Mono, which implements .Net on Unix type operating systems such as Linux, has been integrated into the Gnome desktop on X-Windows. The result has been a large number of experienced Linux and Unix users driven to switch to KDE or XFCE by increased memory demands and decreased stability. This is not necessarily to say that .Net is bad for Windows. But it is different enough from the design philosophy of Unix and Linux so its attempted integration is causing trouble.





C# is so tied to dot Net that its continuation in the long term may be like that of Jobs's Objective C, which was developed for his NeXTStep computers and survives only because you can compile programs written in it using GCC. Jobs had issues with it being incorporated into GCC, however they were obviously resolved. Microsoft had the architecture of the XO (OLPC) laptop changed a very long time ago to incorporate some Windows hooks, and immediately set about trying to put Windows on it. So far there is no sign of it. I see no reason to think they are likely to make dot Net attractive to anyone but Windows developers or to make Windows attractive to anyone but business users and gamers.
Reply:No. First, although there have been efforts (and will be more) to make universal, the .net framework upon which c# depends is still windows-centric. No c# on Mac's, for instance. Second, device drivers. You can't guarantee that the proper version of .net framework will be installed on a particular machine on bootup. Third, embedded systems. No .net framework there: too big. And fourth: c compilers are available for just about every processor family and OS known to man. No such thing for c#.





So don't worry about it in your professional lifetime. OTOH if you're getting a job solely involving windows, c# is a very good bet. A nice language.
Reply:I would suspect that C++ would still continue be used, particularly for low-level programming. Also, I am surprised that you have not mentioned Java - as Java and C# do share many similarities.
Reply:I agree with miket nothing is going to change that dramatically in your lifetime, I think you can count on C and C++ to be around for quite a while yet as it is good for low level


C++ programming Memory and Data Types?

Is it important to know about memory and Data Types in C++? I'm reading a book trying to self teach myself C++ and all of a sudden this book starts talking about memory and data types not really explaining why I need to learn why I need to learn data type unsign short, or short, just tells me that its Size is 2 bytes and the ranges, doesn't tell me why I should learn it. I guess I should also ask any if anyone knows of any good books to read about C++, this book was doing such a wonderful job of teaching me during the first chapter too.

C++ programming Memory and Data Types?
Yes Sure, knowing about Data Types and how much size does every type consumes in memory is really important to you





I will tell you why, you may not notice this now but in advanced state you may need to make an array of million or so, you may need to copy certain variables and arrays to memory to search among them faster.





Its all about optimizing the memory to the best so that you don't waste it, so you don't make a heavy program eating your ram

pink

Best open source projects site in java, vb, ms office, c, c++, Database programming?

Can any one tell me good open source projects site in java, vb, ms office, c, c++, Database programming, downloadeble, editable, tools

Best open source projects site in java, vb, ms office, c, c++, Database programming?
best open source project sits


http://sourceforge.net/


SourceForge.net is the world's largest Open Source software development web site, hosting more than 100,000 projects and over 1,000,000 registered users with a centralized resource for managing projects, issues, communications, and code. SourceForge.net has the largest repository of Open Source code and applications available on the Internet, and hosts more Open Source development products than any other site or network worldwide. SourceForge.net provides a wide variety of services to projects we host, and to the Open Source community.


I started C++ programming about 3 months ago, im bad at maths, but good at C++, will I be able to 3D program?

I am one of the best in the course at programming, but never did it before this. One mentioned that you need to be really good at math to 3D program and that being good at 2D wont really help.





Is he right, or do I have a fighting chance? I am pretty bad with math :S (Il pass/do most math, but with a good bit of effort)

I started C++ programming about 3 months ago, im bad at maths, but good at C++, will I be able to 3D program?
Math plays an important role in 3d programming you need to be some what good at geometry, and algebra. I have done 3d programming and i am currently working on a game, I have used math more then several times. 2d programing is less math related. But if you really want to make a 3d program/game feel free I'm sure if your good at c++ you can do it but it won't be easy. contact me for more help.
Reply:Yes, you can do that. But download the latest DirectX SDK for the month. Then there are tutorials, examples, and more. But it's so awful, its so long (300+MB)


*************** programming C++****************?

i have an assignment for this week which is Write a program that reads in a five-digit integer and determines whether it is a palindrome. the instructor wants us to check to make sure that the user inputs a 5 digit number. It means that if user enter a character or press enter instead of a 5 digit number, the user should get a prompt that says "please enter a number."


is there any code for this in C++. i already tried the .length() but seems like this code is for the character and strings.


can anyone help me with that please? :)

*************** programming C++****************?
I have nothing to add on the other guy but I'll explain a little if ((x / 10000) %26gt; 0 %26amp;%26amp; (x / 10000 )%26lt; 10) verify that it's a 5 digits number you can replace it with ((x%26lt;100000)%26amp;%26amp;(x%26gt;9999)) but I advise you to make the input a string because later when you check if it's a palindrome it will be easier with a string


I hope you understand
Reply:unsigned int x = 0;


bool a = false;


do


{


cin "Enter a 5 Digt Number: " %26gt;%26gt; x;


if ((x / 10000) %26gt; 0 %26amp;%26amp; (x / 10000 )%26lt; 10)


{


then a = true;


else cout %26lt;%26lt; "Invalid Number!";


}


}while(a == false);


HELP!! C++ programming?

can anyone help me do a project in c++ that displays in huge letters CS??? it would look something like this:





CCC SSSS


C SS


C SS


CCC SSSS

HELP!! C++ programming?
Here's Windows batch file 'bigtext' that does that in NT batch language - it will give you some ideas:


http://www.ss64.com/nt/bigtext.cmd.txt

periwinkle

C++ Programming Problem - where do I start?

I have a program I have to write that calculates genotypes AA, AB, %26amp; BB in proportions x, y %26amp; z, for a number of generations that is an input to the program. I have a "function"for P, and then equations for succeeding proportions (x, y %26amp; z), and my problem is this. I know what I have to do, mathematically to get the final result. What I am not sure of where to start is the programming of the function within the program.





Does anyone have any ideas given my desciption? I do not want someone to tell me how to do it all - I just need a nudge in the right direction (IE the first step!).





Let me know if you need more information.





Many thanks in advance!

C++ Programming Problem - where do I start?
Consider this:





What are your inputs? The number of generations? Proportion/probability factors? What exactly are they?


What are your outputs? Proportions for the dominant and recessive genotypes? What else?





So now, you need to have a function that returns the outputs (appropriate return type), while taking in the inputs (arguments).





If you understand the algorithms needed to get the output from the input, then you know what to code inside the function.


C Programming question?

I need help with my assignment? The assignment is to write a program to process a collection of daily high temperatures. Your program should count and print the number of hot days(high temperature 85 or higher), the number of pleasant days (high temperature 60-85), and the number of cold days (high temperature less than 60). It should also display the category of each temperature.





I'm not a programming whiz and I know I have to use some kind of loop. I have a programming book on me I was just wondering if someone could point me in the right direction. Thanks a bunch!

C Programming question?
You're right about using a loop. Just look at some of the different types of looping structures and decide which one will work the best. Make sure you understand how each looping structure works, otherwise you'll run into problems later on down the road.
Reply:Why not pseudocode it out first, and post that here, and then we can offer pointers. When your pseudocode is right, you're overhalfway there and we can help with specific questions.





You'll get a lot of personal satisfaction in doing it yourself -- not to mention show that you've got a pair.


Help me to write a chat programm in C socket programming?

i want to write a program in c socket programming for chat room for chatting





a cliet server communiaction





plz give suggestion who to start the project





give sites

Help me to write a chat programm in C socket programming?
//Here is some server code





/* Server.c */


/* Compile: gcc -o Server Server.c*/


#include %26lt;sys/types.h%26gt;


#include %26lt;sys/socket.h%26gt;


#include %26lt;netinet/in.h%26gt;


#include %26lt;arpa/inet.h%26gt;


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


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


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


#include %26lt;unistd.h/%26gt; /* close*/





#define MAX_MSG 100





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


{


time_t Time;


int rc, sd, newSd, cliLen, recvLen, NUM, SERVER_PORT;


struct sockaddr_in cliAddr, servAddr;


char line[MAX_MSG];


char recline[MAX_MSG];





/*Check to see if there are 2 arguments*/





if(argc %26lt; 2)


{


printf("usage: %s %26lt;port#%26gt;\n",argv[0]);


exit(1);


}





SERVER_PORT = atoi(argv[1]);


if(SERVER_PORT %26lt; 1 )


{


printf("Warning: %i is a valid port number", SERVER_PORT);


exit(1);


}





/* create socket */


sd = socket(AF_INET, SOCK_STREAM, 0);


if(sd%26lt;0)


{


perror("Socket could not be opened.");


exit(1);


}





/* bind server port */


servAddr.sin_family = AF_INET;


servAddr.sin_addr.s_addr = htonl(INADDR_ANY);


servAddr.sin_port = htons(SERVER_PORT);


if(bind(sd, (struct sockaddr *) %26amp;servAddr, sizeof(servAddr))%26lt;0)


{


perror("Cannot bind port ");


exit(1);


}








while(1)


{


/*listen for a socket*/


listen(sd,10);


printf("%s: waiting for data on port TCP%u\n", argv[0],SERVER_PORT);


cliLen=sizeof(cliAddr);


newSd= accept(sd, (struct sockaddr *) %26amp;cliAddr, %26amp;cliLen);


if(newSd %26lt;0)


{


perror("cannot accept connection");


exit(1);


}





/* init line*/


memset(line,0x0,MAX_MSG);








/* receive segments*/


recvLen = recv(newSd, line, MAX_MSG, 0); /*waits for data */


if(recvLen %26lt; 0)


{


perror("Data Error!!" );


exit(1);


}





/*Got data, so output it, and chnage change it*/


printf("%s: received data from %s:TCP%d : %s\n",argv[0],


inet_ntoa(cliAddr.sin_addr), ntohs(cliAddr.sin_port), line);


Time=time(NULL);


sscanf(line,"%d",%26amp;NUM);


Time += NUM;


sprintf(line, "%ld", %26amp;Time);








/*send back time*/


rc = send(newSd, %26amp;Time , strlen(line) + 1, 0);


}


close(newSd);


return 0;


}





/*************************************...


/*************************************...


/*************************************...


/*************************************...


/*************************************...


//Here is some Client stuff...





/*tcpClient.c */


/* Compile: gcc -o tcpCleint tcpClient.c*/





#include %26lt;sys/types.h%26gt;


#include %26lt;sys/socket.h%26gt;


#include %26lt;netinet/in.h%26gt;


#include %26lt;arpa/inet.h%26gt;


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


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


#include %26lt;stdlib.h%26gt;//to conver strign to number


#include %26lt;unistd.h/%26gt; /* close*/








//Define the max message lenght


#define MAX_MSG 100





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


{


int sd, rc, recvLen, SERVER_PORT;


char msg_buff[MAX_MSG];


time_t calTime;


struct sockaddr_in localAddr, servAddr;


struct hostent *h;





/*Check to see if there are 2 arguments*/


if(argc %26lt; 3)


{


printf("usage: %s %26lt;server%26gt; %26lt;port#%26gt;\n",argv[0]);


exit(1);


}





SERVER_PORT = atoi(argv[2]);


if(SERVER_PORT %26lt; 1 )


{


printf("Warning: %i is a valid port number", SERVER_PORT);


exit(1);


}








h = gethostbyname(argv[1]);


if(h==NULL)


{





printf("%s: unknown host '%s'\n",argv[0],argv[1]);


exit(1);


}





servAddr.sin_family = h-%26gt;h_addrtype;


memcpy((char *) %26amp;servAddr.sin_addr.s_addr, h-%26gt;h_addr_list[0], h-%26gt;h_length);


servAddr.sin_port= htons(SERVER_PORT);





/* create socket */


sd = socket(AF_INET, SOCK_STREAM, 0);


if(sd%26lt;0)


{


perror("cannot open socket ");


exit(1);


}








/* connect to server */


rc = connect(sd, (struct sockaddr *) %26amp;servAddr, sizeof(servAddr));


if(rc%26lt;0)


{


perror("cannot connect " );


exit(1);


}





/*input of usernumber*/


char NUM[MAX_MSG];


printf("Enter in a number:");


scanf("%s",%26amp;NUM);





/*sending of number*/


rc = send(sd,%26amp;NUM,strlen(NUM)+1,0);


if(rc%26lt;0)


{


perror("cannot send data ");


close(sd);


exit(1);


}


else


{


printf("Sent %s to %s...waiting on reply.\n",NUM,argv[1]);


}





/*wait for data */


recvLen = recv(sd, msg_buff, MAX_MSG, 0);


printf("Reply recived, UserTime:%s\n", ctime(msg_buff));


return 0;


}


C Programming Experts! HELP!!!??

Is this code right to recieve a text file from the specified location?? I have the code to send the file working properly.





/* Filerecive.c * * * * * * * * * * * * * * * * * * * * * * * * * */


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


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


#define CNTRLZ 0x1A


int main(void) {


FILE * fp;


FILE * dp;


int c;


if ((fp = fopen("C:\\TEMP\\text.txt", "r")) == NULL) {


printf("fail to open data file\n"); return 1;


}


if ((dp = fopen("COM2", "r")) == NULL) {


printf("fail to open COM port\n"); return 1;


}


while ((c = fgetc(fp )) != EOF) {


fputc( c, dp);


}


fputc(CNTRLZ, dp);


fflush(dp);


fclose(fp);


return 0;


}

C Programming Experts! HELP!!!??
hello,





can u paraphrase your question? is this for receiving data from a port and saving to a file or are u telling us there is a problem with the file opening part but the send data by com is working?





Anyways, .... i am not so sure with my answer but :


1. fopen("C:\\TEMP\\text.txt", "r") -%26gt; fopen("C:\\TEMP\text.txt", "r")





if this is for saving the data from a port it should be :


1. fopen("C:\\TEMP\\text.txt", "w+")


2. while ((c) != EOF) {


c = fgetc(dp); /* get from port */


fputc( c, fp); /* write to the file */


}


3. also try to add : fflush(fp) just before close :)





I hope u can clear out your question so we can help u better. good luck and merry christmas in advance.





=)
Reply:hello,





Just post away here on yahoo answers, i think many experts are here in yahoo answers, so they too can help u out =). Whenever time permits, I will check your questions out as soon as I can and assist you. I apologize sincerely for not giving out my mail.





Thanks and hope I can be of service. Report It


night blooming cereus

C Programming Language: Reducing Boolean Expressions?

How do you reduce the following Boolean expressions? To those who answer, please explain how you got to each step to get to the final solution.








1) (a%26lt;b||c%26gt;=d)%26amp;%26amp;(e==f%26amp;%26amp;!(a %26gt;= b))





2) A %26amp;%26amp; B %26amp;%26amp; C || A %26amp;%26amp; C





3) (A%26lt;B||C!=D)%26amp;%26amp;(A%26gt;=B%26amp;%26amp;C==D)

C Programming Language: Reducing Boolean Expressions?
The following answers were tested with the


program at:





http://www.hotlinkfiles.com/files/102925...











Problem #1


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





Given:


(a%26lt;b||c%26gt;=d)%26amp;%26amp;(e==f%26amp;%26amp;!(a %26gt;= b))





Notice that "!(a%26gt;=b)" is equivalent to "a%26lt;b".





The second part of the condition:





(e==f%26amp;%26amp;!(a %26gt;= b))





requires that "!(a %26gt;= b)". However, if that


condition is true, then obviously "a%26lt;b" is also


true. This in turn forces the full left hand


side to evaluate to be true:





(a%26lt;b||c%26gt;=d)





Note that this follows *regardless* of the values


of "c" and "d".








Therefore, this entire logical expression reduces


to:





(e==f%26amp;%26amp;!(a %26gt;= b))








Problem #2


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





Given:


A %26amp;%26amp; B %26amp;%26amp; C || A %26amp;%26amp; C








This condition can be separated into the two


subexpressions on each side of the "||".





If "A %26amp;%26amp; C" is true, then "A %26amp;%26amp; B %26amp;%26amp; C" is


guaranteed to be true.





Conversely, if "A %26amp;%26amp; C" is false, then either


A is false or C is false, which necessarily


requires that "A %26amp;%26amp; B %26amp;%26amp; C" must be false.





Thus, the entire expression can be reduced


to:





A %26amp;%26amp; C





In this case, we can fully test this


with the following "truth table". For


inputs A, B, and C, the output of


either the original or reduced expression


follows:





0 0 0 ==%26gt; 0


0 0 1 ==%26gt; 0


0 1 0 ==%26gt; 0


0 1 1 ==%26gt; 0


1 0 0 ==%26gt; 0


1 0 1 ==%26gt; 1


1 1 0 ==%26gt; 0


1 1 1 ==%26gt; 1








Problem #3


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





Given


(A%26lt;B||C!=D) %26amp;%26amp; (A%26gt;=B%26amp;%26amp;C==D)








For the left side to be true, either


A%26lt;B or C!=D. However, if *either*


condition is true, then the right


side evaluates to be false.





Thus, if the left is true, then the


right is false. If the left is false,


then the right is true. This leaves


us with either:





1 %26amp;%26amp; 0





or





0 %26amp;%26amp; 1





In either case, the final outcome is


always 0 (false).





Thus, the expression can be reduced


to:





(0)
Reply:I will not just give you the answers but I will lead you through the first one. The two main things to consider are order or precedence and negation of two (or more) expressions using the same variables. Precedence is mainly given by parenthesis and then by compiler. I'll assume your instructor/book told you whether to treat an '%26amp;%26amp;' before an '||'.





Using the parenthesis as guidance, examine the first expression. It says (for the whole expression to be true) either a must be less than b OR c must be greater than or equal to d. Furthermore, e must always equal f and a must never be greater than or equal to b.





Now, look at the two relations with common variables:


a %26lt; b !(a %26gt;= b)





One says a must be less than b; the other says a must not be greater than or equal to b. Essentially, they say the same thing. So, you can get rid of one. But which? Well, the one on right '!(a %26gt;= b)' must always occur (given the %26amp;%26amp;) and the other on the left may occur, drop the may. If the one on the right doesn't hold true, the whole expression is false. If it does hold true, this means the one on the left 'a %26lt; b' is also true which also means we no longer care if 'c %26gt;= d' or not.





So, you can simply reduce the expression to read (e == f) %26amp;%26amp; !(a %26gt;= b). Or, if you want to make the second part read more clearly....


(e == f) %26amp;%26amp; (a %26lt; b)


C programming question?

I have to write a program that asks the user to write a sentence and then after hitting the return key, the program rewrites the sentence but with only one space between the words if there was more than one. for example:





This is a sentence with many spaces





the program should write:





This is a sentence with many spaces





So the program ignored all the spaces and put only one space between sentences.





Please no use of arrays, the program should be very very simple.... no advanced programming should be included.





Any ideas/hints/tips that might help.





Thank You all!!

C programming question?
Well, first of all, you have no choice to use an array; a character array (pointer to char) to hold the typed in sentence. Once you have the array of chars you can do a simple for loop. Something like...





int j = 0;


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


{


....if ( pSentence[i] != 20 || i == 0 || pSentence[i-1] != 20 )


........pSentence[++j] = pSentence[i];


}


pSentence[j] = "\0";
Reply:Use strtok from the string.h library, why don't you?





Declare an array and a pointer. As in:


char Buffer[80], *Ptr;





Then do a gets(Buffer); and if you are using GCC you will be told by the linker gets is dangerous and should never be used.





Instead of assigning Buffer's address to Ptr, what you do is your first call to strtok:





Ptr = strtok(Buffer, " ");





Then do a while loop. Once strtok runs out of tokens to return it returns a null string. therefore:





while (Ptr!=NULL){





Since you have probably made a successful call to Buffer already, a NULL pointer will tell strtok to scan from exactly where it is in Buffer right now. So:





printf("%26amp;s ", Ptr);


Ptr=strok(NULL," ");


}





Then you're done so bail.


return 0;





Look up strtok. It's very helpful.





headers would be #include %26lt;stdio.h%26gt;


#include %26lt;string.h%26gt;
Reply:Easy.





Once you've got you string into (I'll leave you to do that) you do the following loop, the string is in sSent.





char *sToken = strtok (sSent, " ");





while (sToken)


{


printf ("%s ", sToken);


sToken = strtok (0, " ");


}


Is there any good C++ game programming books?

Is there any good C++ game programming books out there that are good for beginners and intermediates?

Is there any good C++ game programming books?
Yes, I have a book that is very helpful called "C++ for Dummies". It is written in plain English and not geeky talk, and it helps you learn quickly. It comes with a free compiler and program examples on a disk.


Also check out "The Complete Idiot's Guide to C++".





Good luck!!!


How can I run an exe file by C# Windows programming?

How can I run an exe file by C# Windows programming? I have problems in running an exe file by clicking the button that i made in c# windows programing, can anyone of you write the code of event handler in c# through which i can run exe file by just clicking the button,rest of the code is:


using System;


using System.Windows.Forms;


using System.Drawing;


class ButtonForm : Form {


Button MyButton = new Button();


public ButtonForm() {


Text = "Respond to a Button";


MyButton = new Button();


MyButton.Text = "Press Here";


MyButton.Location = new Point(100, 200);


// Add button event handler to list.


MyButton.Click += new EventHandler(MyButtonClick);


Controls.Add(MyButton);


}


[STAThread]


public static void Main() {


ButtonForm skel = new ButtonForm();


Application.Run(skel);


}


// Handler for MyButton.


{ Please guide me with this part.


}


}


Thank u in advance.

How can I run an exe file by C# Windows programming?
Okay, you already have a function defined, you need to go to your Form.cs file, where the EventHandler is located.





MyButton.Click += new EventHandler(MyButtonClick);





This points to the MyButtonClick function.





**************************************...


Now you need to add:





using System.Diagnostics;








Then create a process:


Process TheProcessYouNamed;





private void MyButtonClick(object sender, EventArgs e)


{


TheProcessYouNamed = Process.Start("EXEToRun.exe");








TheProcessYouNamed.CloseMainWindow();


}

orchid cactus

What book would be best to learn visual c++ game programming?

I am currently looking to begin programming in visual c++. I have some experience with visual basic, and want a good book to learn programing in visual c++, with the primary focus on developing games. I have no experience with c++ or visual c++ so the book would need to be at an introductory level.

What book would be best to learn visual c++ game programming?
The first thing you’ll want to do is learn C++. How can you make games in C++ if you can’t write C++ code itself? The two beginner books written by reputed experts are C++ Primer (5th Edition) by Lippman and Accelerated C++ by Koenig. There are other excellent C++ books, but they aren’t suitable for beginners. Do not go with any other books. They are either obsolete or do not teach C++ properly.





Once you do that, you’ll probably want to look into learning a graphics API. There’s only two: OpenGL and Direct3D. But first, learn C++. You can’t do anything else without knowing the language itself, right?
Reply:I recommend you learn programing 3D graphics first before you jump into game development. Unless you programed games before and have a good understanding of game design theory.





Also I recommend you hit up some 3D game engines to see how they do there magic.





Be sure to have a good math background.





I would recommend a book but there isn't really any good ones out there. There used to be a series of books for game development from premier press called "Game Development Series". They had everything from DirectX to OpenGL along with C++ game engine designing.
Reply:Read About C++ from Robert Lafoer or hyden and hyden then jump for OpenGl game programming but this would give u an idea of game programming in open gl if you are somehow directx oreinted then you need to go for some other book. Note of advice learn about vector graphics and graphics theoritically from book called graphics programming to have some clue as to what is going on behind the scenes because at the end of the day u need to have precision speed in ur games which can only be learnt if you know the low level underlyings


Where to learn C++ for programming a microcontroller?

i want to learn programming a microcontroller using C++ because it will help me make projects based on microcontroller.

Where to learn C++ for programming a microcontroller?
for microcontrollers you don't need to know the full c++ language. I would take sample programs and modify them, a little at a time. Look at other samples.





For u-controllers, there are certain patterns of programming that you must use to make things work. General C++ texts do not address this.


Computer Programming C++ Help!?

I need this program to be done in c++ using , ifelse(if applies), dowhile (if applies), while (if applies), for (if applies) statements;





"Write a program that plays a guessing game where the computer tries to guess a number picked by the user. The program asks the user to think of a secret number, and then asks the user a sequence of guesses. After each guess, the user must report if it is too high or too low or correct. The program should count the guesses. (Hint: Maintain HighestPossible and LowestPossible variables, and always guess midway between the two. This is called a binary search.) The program output should look similar to:





Think of a number between 1 and 100 and press any key.


Is the number 50 (Correct, Low, High)? _h_


Is the number 25 (Correct, Low, High)? _h_


Is the number 13 (Correct, Low, High)? _l_


Is the number 19 (Correct, Low, High)? _c_


Number of guesses: 4


"





Underlined material is user input

Computer Programming C++ Help!?
if guess = h then


try = nexttry


nexttry = (try + low)/2


low = try


elseif guess = l then


try = nexttry


nexttry = (try + high)/2


high = try


else


"I know your secret number!"


end if
Reply:Try to work it yourself, it's easy. Use for loop first and nested if...else statements inside it. Work on an algorithm first, then try yourself. If you are stuck after TRYING HARD, then ask for help.
Reply:Are you asking us to write your C++ program for you???


Programming c subvectors?

i am using C and i need help with subvectors, i have to make a program that does the following





A file contains a list of integers. The integers can, and are likely to, contain a mix of positive and negative values. The name of the file comes into your program via argv[1].


The first n numbers of the file are read by your program. The number n comes into your program via argv[2]. The number n will be no greater than 200,000.





For example, the file could contain the values:





-3 100 -4 -2 9 –63 -200 55





Your program will output a number that is the largest sum found in a subvector of this list. In the example above, the output would be 103 since that is the largest sum that can be formed by adding the elements of any subvector.





A subvector can be the entire list, a single member of the list, or it can be any collection of adjacent numbers. If the entire list of numbers contains negative numbers then your program should output 0.





Here is another example: 1 4 3 -4 8


The answer in this case would be 12 since the entire list of numbers forms the maximum sum.

Programming c subvectors?
#include %26lt;stdio.h%26gt; /* Include lots of standard definitions */


#include %26lt;stdlib.h%26gt; /* Get more useful definitions, like atof() */





main(argc,argv) /* Operating System supplies argc %26amp; argv */


int argc; /* The number of words in command line */


char *argv[]; /* The sequence of words in command line */


{ /* argv[0] is the program name */


int i; /* a loop counter - always an integer */


int highest; /* Highest number*/


int high2nd; /* 2nd highest*/


int temp;


double x, sum; /* working variables, double precision here */


sum = 0; /* Initialize sum to 0 */








for( i = 1 ; i %26lt; argc ; ++i ) { /* loop over args[1,...] */


x = atof(argv[i]); /* convert a string to a number */


if(x%26gt;high1st) {


temp=highest;


highest = x;


x = temp;


}


if(x%26gt;high2nd) {


high2nd=x;


}





}


sum = highest+high2nd;


printf("SUM:%i\n",sum); /* print sum after the loop completes */


}
Reply:You know, the problem here is that us real programmers, although we love writing code, couldn't be bothered to write programs to solve such trivial problems.





Which aspect of the question are you having a problem with? Arrays ("subvectors") can be a bit weird in C sometimes.

palm

A good free guide to C++ Game Programming?

I've just left school for my six weeks summer holidays and I've looked into very basic C++ and C but I want to try and learn the basics of C++ game programming over the next six weeks.


Do you know of any free guides, and also what IDE or software should I use to make the game, I currently have Bloodshed Dev-C++.

A good free guide to C++ Game Programming?
Try to get a book from the library (OK, so I'm old school!) and work through it. Alternatively, there are many "game programming portal" type things on the net. And they usually have tons of tutorials and what-have-you.





Good luck :-)
Reply:Try this link:


http://www.getebooks4free.com/c_%26amp;_cplus_...
Reply:google it
Reply:http://www.talula.demon.co.uk/allegro/





is good to have also.. deals with gfx functions..





as for programming, i'd start off with C instead, then get on to C++





as well , c is ok. c++ might be confusing to get into straight away





as said before, check google for c or c++ tutorials or check your local library.
Reply:There's books out there that offer a game programming guide with C++, but I would avoid them at all costs. Sure, you want to get into game programming, but it's quite difficult with C++. C++ is a complex language, so it's important you focus on learning the language first.





To that end, start with C++ Primer by Lippman or Accelerated C++ by Koenig. These are both recognized books by respected authors, and they are technically accurate. It will take you a while to learn C++ to a usable level, so you need to be patient. You won't be game programming initially, at least not with the fancy graphics you envision. There's a learning curve, and you can't skip it.





I don't recommend starting with C if you want to go the C++ route. I recommend learning C++ over C, but whatever you do, don't flip between them. Bad idea. You'll have to unlearn the programming idioms one introduces, learn a new language and the new idioms of that language.


Ive finished beginning c# game programming, what now?

http://www.amazon.com/Beginning-C-Game-P...





where do i go from here on the path of game development?

Ive finished beginning c# game programming, what now?
Write games. The best way to learn how to do something is to do it. Watch a baby learning to walk - they get pretty good at it, eventually. You're going to write lots of sucko games, just like the baby is going to do little but fall down the first few months. Keep at it and, eventually, you'll write better ones. (The first two years of actually working at a paid programming job, you're still entry-level. Doing it on your own just keeps you at that level longer.)





Actually, the best way is to get programming jobs - forget about writing games and get programming experience. When you can write a simple program, like a game score site, in your head while driving on the interstate in heavy traffic, without making errors in the code, you're ready to actually write a game. (Not in C++, in English.) Write the game - lay it ALL out - then (this will be at least a few weeks after you started to lay it out) code it and see how it works.
Reply:Get experience using what you've learned.





It doesn't really matter if you say you've read a book on c# game programming if you don't even know how to apply it. Either start your own projects to enhance your skills or get a job where you'll be able to.
Reply:Get a job. Mention that you read the book (even though shoving a book in someone's face might not do much). Use your skill as a hobby. Develop a talent for it. Just FIGURE OUT HOW TO USE IT, preferably to your advantage.
Reply:To college.


Software Testing or C/C++/Java Programming?

I m 24 %26amp; a Engineering Graduate, looking for a career change to software, after 4 yrs in industry. I was suggested my friend to take up software testing so that i could get the job easily. But i m interested in programming, i know c %26amp; c++, Planning to learn JAVA,J2ME, so that i could join software company in 5 months time, but people say i m too ambitious to achieve that goal. So guys please suggest is my goals are just dreams and not reality, what should i do to enter software company at the earliest with decent salary package,

Software Testing or C/C++/Java Programming?
im a software tester at the moment, earning about 10 grand a year (but i am 18 so pay is low). the older testers with more experience got paid about 30 grand a year - which is good. i think you can earn a decent salary as a tester and testing is a growing industry, meaning more jobs should be opening up (although some companies are reluctant to employ testers at the moment.) seeing as you have no experience in computing, testing would be a good way of getting into the industry i think. lots of people i work with dont have a computing degree so youll be fine with regards to that. why not apply to do a programming job? it depends largely on the culture of the company - whether theyre happy to employ some one without much experience if they interview well etc. i would say that testing is REALLY BORING! so unless youve done it and like it stay away.. its very repetitive. the software engineers hate it when they have to do any testing. apply for some software jobs and see what happens - if you dont get one hopefully you should at least get some useful advice. knowing C++ is obviously a big advantage. java, pearl and python are also popular in my company. some of the engineers have learnt these languages on the job. if you cant get a software engineering job, then look into testing. good luck
Reply:I too am a programmer (24) and my primary job is testing. I recommend learning unit testing as it combines testing software with programming, and is a hot skill to have. You'll probably make $30 - $40 grand to start. Eventually they'll let you move up and do more programming, but all the beginning programmers are going to get low level work, it's just the way it is.
Reply:Go for your dreams now, otherwise they will become regrets. Java is Open Source now, so easy to get access to for learning. Get on a Linux box or add Linux to that one and start learning again.


Do not get Micro Linux. That is moving backwards. Get an Open Source project that is supported, like Ubuntu Linux. The way it looks, Microsoft owns 10% of Apple and is now buying into Linux and made a move on SAP this week, so learn while you still allowed or permitted to.
Reply:Learn to program. Then even if you get started with a job in testing, you'll have the options to expand. While testers might eventually earn $40k/year, developers can double that with a bit of experience.





Don't worry about J2ME at all to start with. Once you learn the standard stuff, moving to ME is easy. Also, take your C++ experience and add both Java and C#.NET to. The more versitile you are, the more valuable.
Reply:If you know C and C++, why on earth would you want to learn Java? You can get much better work programming in C++, and produce software of a much higher quality...


Help with programming C++?

im just learning how to program C++ from online tutorials and i remember when i was a kid my dad showed me that you can program on something like a console.





i cant find any computer program that would allow me to fiddle around with c++( like making a "Hello world!" program)





any help?

Help with programming C++?
dev c++. Free, easy to use, and great compiler.





http://www.bloodshed.net/devcpp.html
Reply:ok, to first start writing programs, you need an IDE. IDE starts for Integrated Development Environiment. With an IDE, you can write code, compile it, and run it. The ones I would recommend are the Microsoft Visual C++ and Dev-C++, both of which are available online for free.
Reply:gcc is the GNU compiler.


It's free and is available for both Unix/Linux and Windows (plus lots of other operating systems).





http://www.gnu.org
Reply:You can download the Visual C++ 2008 Express Edition, which is totally free as well,


S. B.
Reply:Download and install Boroland C++ builder or Turbo C++ it will give you fast compilation and codes...................

petunia

C++ windows programming?

ok I am pretty good with C++ and i'v been doing it for a long time. When I try to figure out windows.h programming I get lost so quickly.


Am I not ready for it? or does everyone have this problem? If it is common how can I learn it?





Thanks,


S_R_S

C++ windows programming?
LOL...yup that was the same for me too when i started Windows programming...It's different eh?





I think the best thing you can do is to just keep on doing it! You will find your mind will get use to the logic....Not sure which parts you are having troubles with but i gather events-driven logic might be one of them.





Are you looking into MFC or going the less-hand-holding approach to straight up Win32 APIs? For me, i never really liked MFC because i felt i was being held back and so i coded directly with Win32 APIs and worked with setting up my WndProc, etc....





Try not to think of yourself as not ready...you are definitely ready....it is just a different way of thinking...like i said, it was the same for me...i was glad that i forced myself to go through the new style.





If you have questions, feel free to ask me...forgive me if i take a bit to respond (i dont tend to go to my email as often)


C Programming Language: Reducing Boolean expressions?

We are asked to reduce all of the following Boolean expressions. I believe all of my answers are correct and are in the most reduced form, but I just want to make sure. Please let me know if all of the answers I have are correct, and for any that are not correct, please explain how to get to the correct solution.








Use DeMorgan's law to reduce the following Boolean expressions:





a) !A %26amp;%26amp; !B





ANSWER: !(A || B)





b) !A || !B





ANSWER: !(A %26amp;%26amp; B)





c) !(!A %26amp;%26amp; !B)





ANSWER: A || B





d) !(!A || !B)





ANSWER: A %26amp;%26amp; B





e) !(A != B %26amp;%26amp; C == D)





ANSWER: A == B || C != D





f) !(A %26lt; B %26amp;%26amp; C %26gt;= D)





ANSWER: A %26gt;=B || C %26lt; D








Use Distributive law to reduce the following Boolean expressions:





a) (A || B) %26amp;%26amp; (A || C)





A %26amp;%26amp; A || A %26amp;%26amp; C || B %26amp;%26amp; A || B %26amp;%26amp; C





ANSWER: A || A %26amp;%26amp; C || B %26amp;%26amp; A || B %26amp;%26amp; C (from idempotence of


A %26amp;%26amp; A)





b) A %26amp;%26amp; B || A %26amp;%26amp; D





(A || A) %26amp;%26amp; (A || D) %26amp;%26amp; (B || A) %26amp;%26amp; (B || D)





ANSWER: A %26amp;%26amp; (A || D) %26amp;%26amp; (B || A) %26amp;%26amp; (B || D) (from


idempotence of A ||A)





c) a %26gt; b %26amp;%26amp; c != d || e %26lt;= f %26amp;%26amp; a %26gt; b





a %26gt; b %26amp;%26amp; c != d || a %26gt; b %26amp;%26amp; e %26lt;= f (commutativity)





(a %26gt; b || a %26gt; b) %26amp;%26amp; (a %26gt; b || e %26lt;= f) %26amp;%26amp; (c != d || a %26gt; b) %26amp;%26amp;


(c != d || e %26lt;= f)





ANSWER: a %26gt; b %26amp;%26amp; (a %26gt; b || e %26lt;= f) %26amp;%26amp; (c != d || a %26gt; b) %26amp;%26amp;


(c != d || e %26lt;= f)


(idempotence)

C Programming Language: Reducing Boolean expressions?
d)!(!A || !B)


=


(A || B)





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


a)(A || B) %26amp;%26amp; (A || C)


=


A || (B %26amp;%26amp; C)





b)A %26amp;%26amp; B || A %26amp;%26amp; D


=


A %26amp;%26amp; (B || D)





c)a %26gt; b %26amp;%26amp; c != d || e %26lt;= f %26amp;%26amp; a %26gt; b


=


(a %26gt; b) %26amp;%26amp; (c != d || e %26lt;= f)


C++ Web Programming?

I am working on an assignment where I have to do some web programming using C++. (parse a web page etc). I have worked in C++ but I have not done web specific programming. Can anyone point me to resources (books, sample codes) which will be helpful in doing C++ web programming.

C++ Web Programming?
If you are just retrieving webpages (i.e. HTTP protocol), you can use libcurl, and this will simplify things A LOT. In fact, you could just use the curl executable as well. Just call the program with the right arguments and have the output redirected to file.





If it's a custom protocol, you are in for sockets programming. This is system specific, so the answer varies depending on whether you are on a *NIX like system, or on Windows. Googling for C++ sockets programming, C sockets programming, C network programming, and so on will get you a number of resources. Beej's guide is commonly cited as a tutorial.
Reply:Microsoft Visual C++ has some class libraries that you can use to do web programming in c++. The following link has a lot of information on the classes that are specific to internet programming:





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


C++ Windows programming: Can't make this program run?

I'm just starting C++ windows programming and I copied this right out of my book (with a couple of adjustments since i needed to refer to different pathways).


This program compiles, but it does not run. When I try to open the icon that ws produced nothing happens. What is wrong with it?


Here's the program





Window.cpp


#include "window.h"





LRESULT CALLBACK WndProc(HWND hWindow, UINT msg, WPARAM wParam, LPARAM lParam);





int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,


PSTR szCmdLine, int iCmdShow)


{


static TCHAR szAppName[] = TEXT("Skeleton");


WNDCLASSEX wndclass;


HWND hWindow;


MSG msg;








wndclass.cbSize = sizeof(wndclass);


wndclass.style = CS_HREDRAW | CS_VREDRAW;


wndclass.lpfnWndProc = WndProc;


wndclass.cbClsExtra = 0;


wndclass.cbWndExtra = 0;


wndclass.hInstance = hInstance;


wndclass.hIcon = LoadIcon(hInstance,


MAKEINTRESOURCE(IDI_WINDOW));

C++ Windows programming: Can't make this program run?
RegisterClassEx() fails and bails out.


RegisterClassEx() fails because not all fields of wndclass are initialized - some contain garbage. It's a typical mistake that programmers make.





Change declaration of wndclass to this:





WNDCLASSEX wndclass = { sizeof(WNDCLASSEX) };
Reply:this itself is not a program, its a class, it will help you when you write a program and you can call the functions within this file.
Reply:General Cucombre ftw! Ai caramba!

mint

C++ game programming help?

OK im pretty new to c++ but im using a book (C++ for dummies lol). My main goal is to make rpgs and, wel any type of game that im feeling like programming. Im planning on going the Directx route with another book I have (Programing RPGs with directx). I want to know if im going the right route in how im learning all this. I know it sounds a little OCD but I really wanna make games. Im afraid im gonna learn c++ then learn directx, and then find no way of putting them together. Hopefully the books will teach that but please offer any advice or suggesions. (BTW though I will do a lot of 3D games, i will mostly make classic 2d rpgs)

C++ game programming help?
start off with visual c++ and do text based games (rpg, adventure, strategy, etc) written as pure console games (nothing GUI based). After you get a good grip of c++, start learning how to program using DirectX. Using DirectX, keep making text based games, but that now feature graphics, scrolling text, etc. After you get more experienced using DirectX and C++, start making games like said above, pong, and other games that have very few moving objects and sprites (graphics). After you get the hang of using sprites and such, move on to bigger and bigger projects. Remember, that these first few weeks and months will have you taking baby steps, but you will soon see a whole new area of productivity open up to you.
Reply:For now, forget about DirectX. Remember, RPGs used to come in TEXT form. It's the gameplay, not the graphics, that's important (at least, tell yourself that).
Reply:The above answerer is right, of course, and it would help to figure out what you really enjoy about game development -- if its graphics, the link below will get into the Game SDK for Microsoft Visual C++ Express.
Reply:Learn C++, learn DirectX. Don't expect to make anything decent though, start with Tic-Tac-Toe, Ping Pong, Snake, Tron - the baby stuff. After that, keep increasing the level of difficulty.


C++ network programming?

ok so iv been learning c++ for a while now and i wanna start learning some network programming iv been looking arund the web a bit and im getting kind of confused with all the diffrent types there seam to be. So first of what is socket programming is it diffrent to network programming are there any other types and what are they all used for and secondly if any1 knows of some good online ebooks and tutorials on network programming/socket programming that use windows and c++ if u could give me a link to them id really appreciate it thanks

C++ network programming?
May you can contact a expert or you also get help %26amp; post your comment at website like


http://homework.feedmelink.com/...
Reply:this is a good place to start.
Reply:Sockets are network programming. Everything needs to go over sockets to get started. If your using a Windows environment, I used the Winsock MSDN reference pages to help, however it's also just as easy on Linux, where sockets are managed as simple file pointers using open() close() read() and write().
Reply:i found usefull ebook for you, download at http://totme.com/categories/ebooks/C_Net...


Is Object Oriented Programming (C Sharp) a good thing in modern software development? Justify your answer.?

This is the topic that I have to talk about in few days. My supervisor suggested me to say something good about C sharp and also compare Object Oriented Programming with Service-Oriented Architecture (SOA) but this is too hard for me. Anyone can help me with this, about 200 words because I have only few minutes to talk about this. Thank you very much.

Is Object Oriented Programming (C Sharp) a good thing in modern software development? Justify your answer.?
Object Orientated programing is the only way to go. The launguage does not really matter as long as its a firth generation level language. OO allows you to reuse code and thus increase the effectivness of your porgrammin efforts. C#, VB.Net or c++ all allow for OO programming, it jsut depends on what you are trying to accomplish. Top Down programming is useless in this day and time.


Is Object Oriented Programming (C sharp) a good thing in modern software development? Justify your answer.?

This is the topic that I have to talk about in few days. My supervisor suggested me to say something good about C sharp and also compare Object Oriented Programming with Service-Oriented Architecture (SOA) but this is too hard for me. Anyone can help me with this, about 200 words because I have only few minutes to talk about this. Thank you very much.

Is Object Oriented Programming (C sharp) a good thing in modern software development? Justify your answer.?
Try to download the free Visual C# Express 2005 from Microsoft and also check the online documentation of MSDN.





These are the excerpt from the documentation:





"C# Language


C# syntax is highly expressive, yet with less than 90 keywords, it is also simple and easy to learn. The curly-brace syntax of C# will be instantly recognizable to anyone familiar with C, C++ or Java. Developers who know any of these languages are typically able to begin working productively in C# within a very short time. C# syntax simplifies many of the complexities of C++ while providing powerful features such as nullable value types, enumerations, delegates, anonymous methods and direct memory access, which are not found in Java. C# also supports generic methods and types, which provide increased type safety and performance, and iterators, which enable implementers of collection classes to define custom iteration behaviors that are simple to use by client code.





As an object-oriented language, C# supports the concepts of encapsulation, inheritance and polymorphism. All variables and methods, including the Main method, the application's entry point, are encapsulated within class definitions. A class may inherit directly from one parent class, but it may implement any number of interfaces. Methods that override virtual methods in a parent class require the override keyword as a way to avoid accidental redefinition. In C#, a struct is like a lightweight class; it is a stack-allocated type that can implement interfaces but does not support inheritance.





In addition to these basic object-oriented principles, C# facilitates the development of software components through several innovative language constructs, including:





Encapsulated method signatures called delegates, which enable type-safe event notifications.





Properties, which serve as accessors for private member variables.





Attributes, which provide declarative metadata about types at run time.





Inline XML documentation comments.





If you need to interact with other Windows software such as COM objects or native Win32 DLLs, you can do this in C# through a process called "Interop." "

sage

Wat is programming C?

can anybody tell me wat is programming c? is any scope in this? tell me in detail

Wat is programming C?
It's a procedural language developed for the Unix operating system.





It's been upgraded / replaced by C+, C++, Visual C+, and C#. There are tutorials on the web you can look at, but the pop ups were over the top.





So, I sent you to Wiki, and you can go from there.





See the link below.
Reply:It's one of many programming languages. You have to study it, no one can just tell you in detail how to do it on a forum like this. Here is a list of languages and some of their details/uses.





http://www.engin.umd.umich.edu/CIS/cours...


Need site for C, C++ ,Batch file programming?

i need a site where they teach advanced batch file programming, C, C++ and that kind of stuff properly.I Know the basics and need to study the advanced stuff becoz iam too sleepy to listen to the crap they teach in highschool.......

Need site for C, C++ ,Batch file programming?
Hehe..Sammy U'll never change yaar..:)


Socket programming C?

What's the best resource on the net to learn C network programming for socket I/O? (*nix - don't care for windows network programming)

Socket programming C?
I learned a lot about BSD style socket programming from this page by Ken Christensen years ago:





http://www.csee.usf.edu/~christen/tools/...





Another good tutorial can be found here:





http://www.cs.vu.nl/~jms/socket-info.htm...





Enjoy!
Reply:Probably the most cited resource is Beej's guide: http://www.beej.us/guide/bgnet/


Programming C++?

programming: Who can write a program in C++ which shows how a timer works!and designs the graphic of it!(with class and functions)

Programming C++?
you need to program a "timer" class. Then give it methods and properties.. Then main(){}.. And an instance of the class...
Reply:sounds like you didnt do your homework.

alstroemeria

Game Programming C++?

I've been deeply researching into game programming. I've started this past summer trying to find a programming language and it wasn't till recently that I started to get into C++. I followed Wrath lands text rpg tutorials and created my own rpg, but was wondering how to get a game in c++ that is action not text, but using input keys like arrow keys. Even if you can how to use bitmap pictures and the coding for those... I don't want you to start listing the codes, but any websites or books that you would recommend.

Game Programming C++?
I'm currently working on my bachelor's degree in game software development, so I know what I'm talking about.





Both of the above guys make valid points. DirectX and OpenGL are good ones to learn. Learn both, and you'll make yourself that much more marketable.





DirectX isn't a huge headache, it just takes getting used to working with the additional classes and whatnot, in C++ language.
Reply:The SDL library is a wrapper for DirectX. It has lots of fine functions for loading things like PNG bitmap pictures -- with alpha channel for masking -- very useful for games.





See the link.
Reply:You shoud look into the DirectX SDK , its all about working with direct x and all the things it can do Direct3d for graphics and directinput for getting input to your program...
Reply:Well you will need to download the library files for a game engine and graphic engine. As far a graphics go I would suggest learning OpenGL. Yes it is old but there are many many sites out there that have tutorials on code and games for OpenGL. That is a way to get your foot in the door. Dont start with Directx programming. its a headache.


Programming C help?

For programming with C (not C ++) how do you know what to do next in a program? Do you have any tips on what to do first????

Programming C help?
Programming is taking the ability to explain directions to someone else on doing generic things and then converting that into the syntax of the language.





Whatever your assignment is: Do it by hand on paper first and then write down how you would tell someone else to do it. Finally, see if you can translate that into the syntax of C.





If you need to remember something then use a variable. If you need to do something more than once then that is a for or while loop. If you need to make a decision, you will use an if or case.





I hope this helps.
Reply:I'm not sure what you are asking. When a C program runs, the place that it starts is in the main function, which looks like this (everything I wrote between the /* and */ is just a comment which you can read but is ignored by the C compiler):





int main()


{


/* This is where you write C statements that tell the computer what you want it to do, including 'calls' to other functions that tell the computer what to do. */





return 0;


}
Reply:i think i got u.......


u have problem wid analysing d Question


so ur 1st step is 2 go thru d core of d prob statement n den start programming


okay den , consider urself as a computer and think tht if u r given to solve dis problem wht all variables or inputs u'll need


followed by processing u'll require


and finally d outputs





n den try to implement problem frm d computer's point of view considering the problem statement correctly





just think on d above data atleast twice..............coz most of my students get benefited by dis logic





i hope it'll help
Reply:your question is so vague!!!!


C as in disk drive C?


and you want to PROGRAM it? what do you mean?


IM/email me!


i could help
Reply:Huh? Your question doesn't really make sense... are you asking, "how do you know what to do next in a specific program?" ... I suppose that depends on what the program is meant to do. Or are you asking "How do you know what to learn next in C once you've learned the basics?" ... again, we'd need more details to say where you are in your studies and what you consider "the basics."
Reply:What to do first? What to do next? Try this:





1. Understand the problem to be solved.


2. Design the program.


3. Write the code.


4. Test the code.





Those steps, of course, are not language-specific. If you want to skip the preliminaries, and go straight to writing a C program, start here:





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





}





What to do next depends entirely on what you need your code to do. Your question is much to vague for me to give any more specific advice.


I am tying to do my homework which has to be written in the C programming language...?

i was trying to use what i think you would call a C header which is:





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





but when ever i try to compile the program it jumps to this weird file which i think is the actual conio.h file itself. I have never had this problem before, is there any why i can restore the defaults so I don't have to deal with it calling an incorrect .h file again?

I am tying to do my homework which has to be written in the C programming language...?
Well, maybe your file "conio.h" its corrupted. You may try to copy from anyone else and paste it on the folder where your libraries and headers file are. I have it from a very very old version of TurboC, if you want it, you can mail me.
Reply:try:





#include "conio.h"
Reply:stdio.h


What would the code look like if this problem was designed using C++ programming?

Write a C++ Program to count the total number of occurrences of the number '2' in a series of 10 numbers input by the user.





Two codes must be submitted, one which implements the above task using a WHILE loop, and the other which implements the above task using a FOR loop.

What would the code look like if this problem was designed using C++ programming?
Why not write one program with 2 functions, one using while loop and the other using for loop?


Try this:





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


using namespace std; //don't use it if u r using an old compiler





class counter{


int input,cnt;


int inputs[10];


public:


counter();


void get_input(int ); //so that you can search other numbers also, not only 2


void cal_for();


void cal_while();


};





counter::counter()


{


cnt=0;


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


inputs[i]=0;


}





void counter::get_input(int m)


{


input=m;


}





void counter::cal_for()


{


cout%26lt;%26lt;"Input 10 numbers:\n";


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


{


cin%26gt;%26gt;inputs[i];


if(inputs[i]==input)


cnt++;


}


cout%26lt;%26lt;"The number of occurence of the number"%26lt;%26lt;input%26lt;%26lt;"in this series of inputs is:"%26lt;%26lt;cnt%26lt;%26lt;"\n";


}





void counter::cal_while()


{


cout%26lt;%26lt;"Input 10 numbers:\n";


int i=0;


while(i%26lt;10)


{


cin%26gt;%26gt;inputs[i];


if(inputs[i]==input)


cnt++;


i++;


}


cout%26lt;%26lt;"The number of occurence of the number"%26lt;%26lt;input%26lt;%26lt;"in this series of inputs is:"%26lt;%26lt;cnt%26lt;%26lt;"\n";


}





int main()


{


counter C;


int a;


cout%26lt;%26lt;"What is the number you are looking for?\n";


cin%26gt;%26gt; a;


C.get_input(a);


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


C.cal_for();


C.cal_while();


return 0;


}





One more thing. I don't have a c++ compiler here. So I couldn't check and debug it before sending. Hope you will be able to fix syntax errors if there is any.:)
Reply:let me just write out a possible for and while in a pseudo-code that you could use.





for(counter=initial value; exit condition(s); [change counter's value])


body of the loop;





counter=initial value;


while([not] exit condition)


body of the loop with some way to change counter's value;





work out the rest. Homework assignment? Perhaps ask in homework section.

primrose

How to modify values in an array and print the new values in C/C++ programming?

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





void main()


{


int n, i,j, bit[8];





printf("\nEnter the number of bits that you want to convert to unipolar: ");


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





for(i=1;i%26lt;=n;i++){


printf("Enter the bits(%d): ",i);


scanf("%d",%26amp;bit[i]);





}








printf("The stream of bits is: ");


for(i=1;i%26lt;=n;i++){





printf(" %d",bit[i]);


}





}





that's the program in C that i've written to enter and display a stream of bits [0,1].


but i am having troubles to convert the values in the array to unipolar voltages.





Can someone help me with the code of how to change the input bits [1] to 5v and the bits [0] to 0V and display the unipolar voltages.

How to modify values in an array and print the new values in C/C++ programming?
What is the big deal? Arrays and pointers are very similar, in fact, C tends to pass arrays by reference while passing individual variables by value -- meaning you pass it to a function and can usually modify the values directly using either array[offset] or *array+offset.





An array is a contiguous block of memory which holds as many elements as you have set aside memory for. While pointers can be arcane and therefore it is possible to approach arrays in an arcane manner, there is nothing arcane about arrays themselves unless they are strings.





Assuming what you enter are 1s and 0s, then this line will convert all the 1s to 5s:





for (i=1;i%26lt;=n;i++) if (bit[i]==1) bit[i]=5;





And your program shouldn't crash. It will store garbage in all the elements you don't specify, it will crash if you try to store eight or more values (arrays start at array[0] not array[1]) and it won't check for improper inputs but it's all straightforward.





You can also add an else bit[i]=0;


I have to write a numbers convert to roman numerals for c programming and pseudocode?

plz help me i have to write a program using c and pseudocode... numbers converting to roman numerals just basic will do





TY

I have to write a numbers convert to roman numerals for c programming and pseudocode?
I hope you aren't expecting a full program here. What part don't you know how to do?
Reply:Maybe some type of array that replaces each number with the roman numeral. Think it out.
Reply:start at the largest number you're going to handle, say 100s.





divide your number by 100 and that's how many Cs you'll have.





Then divide by 50 and add that amny ls.





Then divide by 10 and add that many Xs





etc.





You'll have to account for special situations like IX, IV, etc.


Can you have two or more files open for writing when doing C++ programming?

I'm using this syntax to open the file for writing:


pointertoopenfile = fopen("file.txt","w");





To restate my question, can I open two or more files like this to write to in C++? I would like to open up two or three files at the beginning of my program, be able to write to them throughout the program, and then close them all when I'm done.





It seems like it only works to have 1 file open for writing at a time. My other option is just to open and close each file as I want to write to it and append to previous written text with:





pointertoopenfile = fopen("file.txt","a");

Can you have two or more files open for writing when doing C++ programming?
Absolutely yes!


Full Code(How I do it):


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


int main ()


{


fstream file1;


fstream file2;


file1.open("file1.txt",ios::out);


file2.open("file2.txt",ios::out);


file1%26lt;%26lt;"Hi!";


file2%26lt;%26lt;"Bye!";


file1.close;


file2.close;


return 1;


}
Reply:I have a program that opens and writes to 4 files:





f1 = fopen(File1, “w”);


f2 = fopen(File2, “w”);


f3 = fopen(File3, “w”);


f4 = fopen(File4, “w”);
Reply:As long as you use a different variable for each file (pointertoopenfile1, pointertoopenfile2, pointertoopenfile3) you won't have any problem.





But, depending on the file type (text, data), you may be able to open the file for append and just add to it. So you can open the file, append, close the file. That way, if the program crashes, or it has to abort, everything it wrote so far is saved.


How do I use Newton Raphson method for solving 2-D equations in C programming?

I was given the problem Find on the next page an outline for a C program that solves two nonlinear equations


f1(x,y) = 0


f2(x,y) = 0


PROGRAM OUTLINE: Newton-Raphson Method in 2-Dimensions








To solve:


0 = f_1 (x,y) = x*x - 2.0*x - y + 0.5





0 = f_2 (x,y) = x*x + 4.0*y*y - 4.0





I already know how to do 1 dimensional, a psudocode would be preferable, or at least some form of direction.

How do I use Newton Raphson method for solving 2-D equations in C programming?
You're actually trying to solve 3-D equations. You'd graph these functions f1 and f2 as z = f1(x,y) and get a 3-D surface.





The Newton-Raphson method is to use the derivative to find a better estimate for a zero.





For a 2-D function, y = f(x), each iteration takes x_guess and produces x_next_guess like this:





x_next_guess = x_guess - ( f(x_guess) / f'(x_guess) )





where f' is the derivitive, d f(x) / dx.





To expand that to two variables, think about choosing a random (x, y) point instead of an x value as the guess. Then consider that you can get two derivative functions:





g(x,y) = d f / dx, and


h(x,y) = d f / dy





Then you can use those derivatives to find the next point (x_next, y_next) to use as an improved guess.





x_next = x - ( f(x,y) / g(x,y) )


y_next = y - ( f(x,y) / h(x,y) )

queen of the night

How to create a core dump file in linux during c / cpp programming?

i am not able to create a core dump file by executing the c programing . plz suggest that . how i should make it .

How to create a core dump file in linux during c / cpp programming?
Creating a core file is easy. Just do something illegal like


access invalid memory.


Put this in your code, it should crash your program.


strcpy (myUninitializeVar, anotherUnitializeVar, 10000000);





Make sure you declare myUnitializeVar, and anotherUnitializeVar, just don't initialize it or set it to some huge weird value.


This should cause a core dump.


Coding required urgently!!-to download file from HTTP server using 'C' programming language!!?

Can anyone send me a Unix based 'C' program to download a file from a HTTP server!!

Coding required urgently!!-to download file from HTTP server using 'C' programming language!!?
You can also load the page in your browser.


Select view%26gt;Page Source


Then save that as a file.
Reply:http://www.gnu.org/software/wget/





#
Reply:download firefox or another internet browser and you can magically download files.....also try the ftp command it might work for you


Please help me on this. pretty plz with sugar on top? C++ programming doubt?

hi.this is my home work and i find C++ extremely tough.


i dont kno how to do this program.








1)write a program to perform on a string class without using language


supported built in string function. The member function should do the


following operations.


1. read the string


2.display the string


reverse the string


3.copy the 1st string into the second and vice versa


according to the users


choice


4.concatenate the strings





i gotta submit this crap on wednesday. plz help...god will bless u fer eternity if u help me on this.

Please help me on this. pretty plz with sugar on top? C++ programming doubt?
why don't u at least TRY to solve it, and then post your source code, and we can help you finish it.
Reply:"pretty plz with sugar on top?" Are you 5 years old? Do your own homework.
Reply:A string is simply an array of characters that is NULL terminated. You can do all the processing you need in your user function using a while loop testing for the NULL as the end of the string. Remember that the first array element is numbered zero.


Where and what do you need to download to be able to do C++ programming?

I took an AP Computer Science course using Java several years ago and now am in interested in learning C++ by myself; don't remember much about it now (hopefully my memory will get refreshed as I start) and I was wondering what programs (free) I need to download to start; for ex. I remember I downloaded BlueJay program to learn and program in Java. Any help will be greatly appreciated!

Where and what do you need to download to be able to do C++ programming?
You need a compiler, a plain text editor or IDE, and resources/references.





Compiler: There are two big compilers out there. The first is gcc which runs on Linux and *Nix systems. It has a windows port called MinGW. The second is Microsoft Visual C++, which is windows only. gcc/MinGW is free. Visual C++ is not, but you can get a free "express" edition.





Editor/IDE: There's a bit more variety here, but I'll assume you're on windows. There's three choices worth mentioning for an IDE. The first is Visual Studio which costs quite a bit of money. The second is Code::Blocks, which is free. The third is Dev-C++/wxDev-C++.





Finally, get yourself a real book. Accu (http://accu.org/index.php ) has a list. The site doesn't seem to be working ATM, but when it does, take a look at the book reviews for Beginner's C++. My choices go to C++ Primer by Lippman and Accelerated C++ by Koenig.





MinGW: http://www.mingw.org/


VC++ Express: http://msdn.microsoft.com/vstudio/expres...


Code Blocks: http://www.codeblocks.org/


wxDev-C++: http://wxdsgn.sourceforge.net/





I've omitted a list of plain text editors, and since there's so many, please Google.
Reply:All you need is any C++ IDE( Integrated Develop Enviroment) so you can program, then compile and produce the application. Some reccomendations are:





MS Visual Studio (A little pricey, however it is fairly nice and easy to use -


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





Mars C++ IDE (Free, however not as easy of an interface as Visual Studio) - http://www.digitalmars.com/download/free...
Reply:http://www.bloodshed.net/devcpp.html has a free C++ IDE.





http://www.cprogramming.com/ has C and C++ tutorials
Reply:Microsoft has a free version of its C++ creator/editor for download. You must install the .NET framework to run it (it's also free from MS).


There are also video tutorials on how to program in C++ at the MS site.


See links below.

baby breath

How can I declare 8 floating point numbers in C programming language?

I need to write a C program tha reads 8 real (floating numbers) from another file (that contains the 8 numbers). Problem is, I can't figure out how to write my decaration statement to take into account the 8 values that i expect to display.


As in i don't know how to put in the form:


float variable-name.





Can someone help?

How can I declare 8 floating point numbers in C programming language?
You can declare them as array of 8 floating point nums right.. like


float num[8];





then read numbers into each number(I believe you got no problem in reading nums from file)





Note :: if file is binary file you can read entire data as a block





as fread(num,1, 8*sizeof(float),your_file_pointer);


Saturday, May 22, 2010

How can we convert English language in to Hindi language in C and C++ programming?

Please give me the whole process to change english language in to Hindi Language. I am talking about the output of the C or C++ program. Means one person will write in english and output will come in hindi language.


Please tell me who we can do that.

How can we convert English language in to Hindi language in C and C++ programming?
I can tell you what you do in the Microsoft world.





When you build a program using MFC/DevStudio, you can create a separate resource only DLL that has the strings for all your messages in it. You build one with the messages in English and one in Hindi. Your installer code will have to allow the user to select the language and then coyp the correct version of the DLL into the install directory.








In your main program code, instead of coding a literal, (something of the form "This is a string.") you instatiante a CString and load it from the resource table.





The code looks something like this:





CString strMessage;





strMessage.LoadString(resourceID);





AfxMessageBox(strMessage);





The other thing that you have to remember to do is to build all of your code using the _UNICODE compiler flag. That way the compiler will use two byte wide characters for all of your CStrings.





You can check on Microsoft's web site for more information on this. Search under the topic "Internationalization".

clear weed