Help with c++ program?
551157
Alright. Here's the deal. \n\nSince this is your first course, here are some tricks.\n\nIf the program will have an input of name, month,and day the hurricane, then you will need 4 variables. A string and 3 integers.\n\nHow will you use them? How many times will you repeat the loop?\n\nIf you do not know how many times you want it to be repeated, then  the wisest choice is a do/while. Otherwise, let the user tell you how many times it should be done.\n\nYou will make those 4 variables. They should be arrays, make sure they are big enough.\n\nit will be something as simple as this:\n\nlet the user tell you how many times he want it to be repeated:\n\nint timesToBeRepeated = 0;\ncin >> timesToBeRepeated;\n\nfor ( int i = 0; i < timesToBeRepeated; i++ )\n{\n\n      cout <<"Enter the Hurricane name: &#92;n";\n      cin >> hurricaneName[i];\n         .\n         .\n         .\n}\n\nthen, to print it out,  just do something like this:\n\ncout <<"Hurricane Name"<<"      <<"Day"<<..<<endl;\n\nthen:\n\nfor ( i = 0; i < timesToBeRepeated; i++ )\n  cout << hurricaneName[i] <<"   "<<....<<endl;\n\nWork out the rest, but that is pretty much it., Any doubt, contact me.
225161
The quick answer is that you would know how to program in c++. I dont think most people would want to write that for you just to give an answer but you never know. \n\nTry using planetsourcecode and see if you can find something similar enough to modify...
232131
#include<iostream.h>\nint main() \n{ \n   int stop=false;    \nchar pl='X';    \nchar p; //is used for checking when a game is won  \n  \nint v; //value    \nchar list[]="123456789&#92;0"; //create our array that holds all the values \n\n   do { //start our while loop        //INPUT \n       cin >> v;        //MARKING \n       if (list[v-1]!='X' and list[v-1]!='O')\n {       \n    list[v-1]=pl;       \n }        \nelse\n {  \n     cout << "That place is already taken.&#92;n";   \n      goto skip; //if its already taken skip the turn switch             \n}  \n    if (pl=='X')\n {  \n          pl='O';  \n   }\n   else\n { \n \n          pl='X';  \n      }        skip:;        //win checks   \n     for (int w=0; w<2; w++)\n{    \n        if (w==0)\n{       \n        p='X';   \n         } \n           else{ \n                p='O'; \n           }\n     for (int z=0; z<9; z=z+3)\n {\n     if (list[z]==p and list[z+1]==p and list[z+2]==p) {                 \n  stop=true; \n        goto GAME_END;    \n            } \n           }\n            for (int z=0; z<3; z++) { \n        if (list[z]==p and list[z+3]==p and list[z+6]==p) {\n                   stop=true;            \n       goto GAME_END;        \n        }  \n          }        \n    if (list[0]==p and list[4]==p and list[8]==p or list[2]==p and list[4]==p and list[6]==p)\n{     \n          goto GAME_END;   \n         }   \n     } \n       //PRINTING OF THE VALUES       \n for (int x=0; x<9; x++) {  \n           cout << list[x];   \n          if (x==2 or x==5 or x==8) {  \n              cout << "&#92;n";    \n         }    \n    }   \n     //END PRINTING OF THE VALUES \n       //system("PAUSE");   \n }\n while (stop==false); \n//End the while loop    \nGAME_END:;      \n  cout << p << " wins!&#92;n";      \n  system("PAUSE");\n}
120342
To really hone your abilities I recommend looking over some of the programming contest problem archives.  They are on the level of a week-long programming assignment in college and teach a variety of different skills: working from problem description to solution, basic data structures, basic algorithms, testing exterme cases...\n\nBeing able to solve problems like these will prepare you for any challenge you will come across :-)\n\nI am also including a few links to C++ resources for you.\n\nGood luck :-)
172063
http://www.thefreecountry.com/compilers/cpp.shtml
981994
pseudo code sort of, based on C++... easiest for me... I am going to do this with an array of integers because the number of integers read into the program can be different than just three.  This can be easily changed though...\n\nstart program:\n\nint arrayInt[3];  //  places to store three integers\nint largestNumber = 0;  // place to store largest number\ncout << "enter three numbers:  ";   // request for three numbers\nfor (int i = 0; i < 3; i++)\n{     cin >> arrayInt[i]; }    \n// takes the three values from the user's input and stores them in an element in the arrayInt array.\n// so... now you need to compare all of the elements in arrayInt\nfor (int i = 0; i < 3; i++)  // do this three times\n{\n     if ( arrayInt[i] > largestNumber )  \n// comare largestNumber to the current element in the array\n// if it is larger, give largestNumber the value of that element\n     {\n         largestNumber = arrayInt[i] );\n     }\n}\n\n// display the largest number\ncout << "the largest number is:  " << largestNumber << endl;\n\n ******************************************************************\n\n1. initialize variables for the three input integers and a variable to store the largest integer (set this one equal to zero).\n2. ask the user for the three numbers\n3. read the user's input into the variables to store them\n4. compare the values stored in the three variables by either doing it individually (if an array is not used) or with a for loop.  Go through each of the three variables that store the user's input and compare the stored value to the largestNumber variable.  The largestNumber variable should be set equal to 0 since we know that all the numbers will be non negative, therefore 0 is the lowest any of the input numbers can be.  If the value of a variable that stores a user given integer is larger than the largestNumber variable, store the value of the input variable in the largestNumber variable ( largestNumber = inputValue2 ).  As you check all of the three input variables, the largest of all of the values checked will be stored in the largestNumber variable. \n5. tell the user the largest variable
109430
I use notepad++ its a free program that you can search for and download. once you have it you can put it in c++ mode and start writng. once your finished compile it
747743
Can not give you the code or you shall not learn... so please see Page 534 of "Mastering C++" by  R Venugopal, Rajkumar & T Ravishankar  from Tata McGrawHill.\n\nI hope this will help you...
440282
in c main can return void but not in c++\nin c++ it alsways return an int
454838
For existing programs that do this, see PSLIST and ProcessExplorer.  \n\nTo write your own in C++, see this great Code Project article by Ahmed Yassin: http://www.codeproject.com/threads/Tasks.asp\n\nA comment at the end of the article mentions 3 other ways to do it as well:\n\n1. ToolHelp \n2. PSAPI\n3. Read Registry (check platform SDK sample PView)\n4. some function exported by ntdll.dll \n\nAlso see the MSDN help on the functions used in Ahmed's article.\n\nGood luck!
557543
#include<iostream>\nusing namespace std;\nint main ()\n\n\n    {\nint number;\nint answer;\n    cout<<"Please enter number: ";\n    cin>>number;\n    \n    cout<<number<<"! = ";\n    answer = number;\n    while (number>1)\n\n\n        {\n        answer=answer*(number-1);\n        number--; \n    } \n\n    cout<<answer; \n    return 0; \n}
670568
Try Planet Source Code:\n\nhttp://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=3270&lngWId=3\n\nThis one's in C++. You should be able to convert it back to C...
561896
Hi,\n\nYou can start reading the basic section in C++, they teach you on what are variables, what are datatypes, and what are loops.\n\nThey will teach you how to use arrays and loops and conditionals.\n\nThat is your best bet...\n\nPick up any standard C++ book and read he intro to programming!
1135646
Your best bet is to google the topic. I have done this for C++ and found numerous sources that detail the language. Try C++ file extensions, and then search. This should bring up sources that will have the info you need.
997805
==================\n#include <iostream.h>\n\nint main(void)\n{\n\n   int count; // holds the count\n   float sum, number, avg;\n\n   sum = 0.0;\n   count = 0;\n\n   cout << endl << endl   //  Make some space\n        << endl << "Enter a number.  Enter a zero (0) when you have"\n        << endl << "finished entering numbers and want to compute the"\n        << endl << "average of the inputted numbers." ;\n\n   do {\n         cout << endl << endl << "Data element #" << count + 1\n              << ": ";\n\n         cin >> number;\n\n         if (number != 0.)\n           sum = sum + number;\n           count = count + 1;\n\n      } while (number != 0.0);\n\n      averg = sum / (count-1);\n      cout << endl << "The average is: " << avg\n           << endl << endl ;\n      return 0;\n}\n\n\n==================\n\nThis program computes the average of a set of data values. Commented a bit for you to understand\n\nEnjoy
646616
class publication\n{\n   private :\n      char title[20];\n      float price;\n   public :\n      void getdata()\n      {\n          cin>>title;\n          cin>>price;\n      }\n};\nclass books :: public publication\n{\n   private :\n      int pagecount;\n   public :\n      void getdata()\n      {\n          cin>>pagecount;\n      }\n\n};\nclass tape :: public publication\n{\n   private :\n      int playing_time;\n   public :\n      void getdata()\n      {\n          cin>>playing_time;\n      }\n};
484581
I am not sure what program you tried, but here is one that should work on borlands compiler.\n\n#include <iostream>\n\nint main() {\n\n    std::cout<<"Hello, world!&#92;n";\n}\n\nI have included the 'std::' namespace in front of the cout.\n\n<Edit>\nAre you running the program from the command line, or just clicking on the exe?\nIf clicking on the exe, a command line will pop up, then disappear after displaying hello world.\nYou need to run it from the command line.