I need help w/ a C++ loop based program?
953641
I can only say so much because those equations are too long for two in the morning. Not that it matters; I just won't be retyping them. But you certainly need a bunch of random things for this. First, you need a variable -- a char, probably, since you don't care about any input beyond that. I don't know what the compare thing is going to output, but that'll come.\n\nI suggest an array for the old and new charts.\n\nGeez, what's the syntax? int oldchart[11], or something? I'm getting too used to Java. Anyway. Since you're going in increments of 5 from 0 to 50, you'll have a 0, 5, 10, ... 45, 50 -- that is, 11 different speeds, right? So you'll need an array for the old chart and an array for the new chart, both with a size of 11. Do you get where I'm going?\n\nCalculating the chart takes a bit more thinking. We'll ignore the actual process of getting input for the moment and just deal with filling it in. I'll suggest a method, and explain afterwards:\n\nint speed;\nfor(int i = 0; i < 11; i++)\n{\n   speed = i*5;\n   oldchart[i] = <calculate wind chill>;\n}\n\nThe same thing could be applies to the newchart array. The index, i, will go from 0 to 10, matching the indexes of the array, right? Since you're going by increments of 5, the speed for slot i will be i*5. That takes you from 0 to 50.\n\nSo after you pull that off for the old and new, you've got charts saved in the variables. Printing them is kind of similar to what happened above -- you use a loop to output what's in the array, using i*5 for the speed.\n\nNow, granted, you could combine this and the above step so you wouldn't need the arrays at all--you'd just recalculate and print every time. But I find it easier to organize my thoughts by going a way that deals with one issue at a time... It depends on what you prefer at this point.\n\nfor(int i = 0; i < 11; i++)\n{\n   speed = i*5;\n   cout << "Speed: "<< speed << " Wind Chill: " << oldarray[i] << endl;\n}\n\nLet's see...\n\nDisplaying the menu is easy--just use cout << "your menu stuff" << endl;\nInput is a bit stranger, I think. For something like this, just use a cin and check afterwards if it's right. Um, let's see... I'll give this to you in pseudocode--you should be able to work out the actual stuff.\n\nwhile ( the user doesn't want to exit )\n//this is just a logic thing -- if the user is done, then what?\n{\n     take the user's input;\n\n     if the input is 'o' or 'O'\n     {\n          calculate and print the old chart\n     }\n\n     else if the input is 'n' or 'N'\n     {\n          calculate and print the new chart\n     }\n\n     else if the input is 'c' or 'C'\n     {\n          calculate and print both the old and new charts (?) (whatever compare does)\n     }\n\n     else if the user wants to exit\n     {\n          end the program (usu. with return 0 or something of that nature)\n     }\n\n     else the user's input was bad\n}\n\nMind that for this to go well, you'd have to mind a few issues -- as I wrote above, if the user doesn't enter what you expect them to. Also, you'd have to deal with a case where the user decided to print charts before entering data into the old or new charts. For that, you should give the temperature a default value, like 0, so the charts can still be calculated.\n\nYou can see that I wrote in a calculation for every print, which is what I was saying before with it not being necessary. You could technically use the for loop I gave for printing but just replace the reference to the array with the calculation for the wind chill.\n\n...Don't know if I covered all of it, but I should be getting to bed. ^^;
1151029
try this for an example, you will have to modify the code, I won't do your homework for you, but this should help you out\n\n\n#include <iostream>\n#include <fstream>\n\nusing namespace std;\n\nbool Load(ifstream&);\nbool ReadData(ifstream&, char[],int&);\nvoid PrintData(const char[],int);\nvoid clear(ifstream&);\n\n\nvoid sort(char[],int);\nvoid swapValues(char&,char&);\nint indexOfSmallest(const char a[], int startIndex, int numberUsed);\n\n\nint main()\n{\nifstream file;\nint iSize;\nchar cData[100];\n\ntry\n{\nif(!Load(file))\nthrow "File Handle could not be acquired";\n\nfor(int i=0; i< 3; i++)\n{\nif(!ReadData(file,cData,iSize))\nthrow "Data could not be read";\ncout << iSize << endl;\nPrintData(cData,iSize);\nsort(cData,iSize);\nPrintData(cData,iSize);\n}\n\nfile.close();\n}\ncatch(char* szError)\n{\ncout << endl << "Error: " << szError << endl;\nexit(0x01);\n}\n\nreturn 0;\n}\n\nbool Load(ifstream& iFS)\n{\ntry\n{\niFS.open("c:&#92;test.txt",ios::in);\nif(!iFS.is_open())\nthrow false; \nthrow true;\n}\ncatch(bool bCode)\n{\nreturn bCode;\n}\n}\n\nbool ReadData(ifstream& iFS,char cData[], int& iSize)\n{\ntry\n{\niFS >> iSize;\nif(iSize < 0);\nelse\n{\nclear(iFS);\nfor(int i=0;i < iSize;i++)\niFS.get(cData[i]);\nclear(iFS);\n}\nthrow true;\n}\ncatch(bool bCode)\n{\nreturn bCode;\n}\n}\n\nvoid clear(ifstream& iFS)\n{\nchar c = '&#92;0';\nwhile(c!= '&#92;n' && !iFS.eof())\niFS.get(c);\nc='&#92;0';\n}\n\n\nvoid PrintData(const char cData[], int iSize)\n{\nfor(int i=0; i < iSize; i++)\ncout << cData[i];\ncout << endl;\n}\n\n\nvoid sort(char a[], int numberUsed)\n{\n    int indexOfNextSmallest;\n    int index;\n\n    for (index = 0; index < numberUsed - 1; index++)\n    {\nindexOfNextSmallest = indexOfSmallest(a, index, numberUsed);\n        swapValues(a[index], a[indexOfNextSmallest]);\n    }\n}\n\nvoid swapValues(char& v1, char& v2)\n{\n    char temp;\n    temp = v1;\n    v1 = v2;\n    v2 = temp;\n}\n\nint indexOfSmallest(const char a[], int startIndex, int numberUsed)\n{\n    int min = a[startIndex],\n        indexOfMin = startIndex;\n    int index;\n\n    for (index = startIndex + 1; index < numberUsed; index++)\n        if (a[index] < min)\n        {\n            min = a[index];\n            indexOfMin = index;\n        }\n\n    return indexOfMin;\n}
856373
look in the boost site:\n\nhttp://boost.org
997912
You can get help from vc++ help files or internet,  if you can't do it by yourself, then join any institute.\n\nHere you can find book about Visual C++ Programming by Example  Hope it would help you.\nhttp://www.amazon.com/gp/product/0879305444/ref=pd_sim_b_4/104-9024259-6746365?%5Fencoding=UTF8&v=glance&n=283155\n\nVisual C++ Walkthroughs  \n\nWalkthroughs give step-by-step instructions for common scenarios, which makes them a good place to start learning about the product or a particular feature area.\n\nThis is More detailed and free from Microsoft, hope it would help you.\n\nhttp://msdn2.microsoft.com/en-us/library/e6w9eycd.aspx
102928
I'm not a php programmer... but using other programing languages is quite simple. Use an algorithm like this: define a matrix or a vector (depends on how many numbers you want listed) and start the random procedure: first chooses a number and compares it with every variable of the matrix/vector, if it's different then write it on the page and in the current position in the matrix. This is just a pseudo-code, but it's easy.
765887
Assuming your above program works, which I don't think it will because your doing an aggregate operation on an array..you should assign values to indexes in the array...eg cin >> Date[0] or use a for loop or something...regardless since your putting everything in an array anyway simply do something like using a counter variable, personally i think it would be the easiest way of doing something like that.\n\nint counter = 0;\n\ncout << enter day to subtract << endl;\ncin   >> counter;\ncout << Date[1]  - Date[counter] << endl;\n\nI belive using
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
588997
I use "C++ How to Program" by Deitel & Deitel.\nIt's really good
859662
This sounds like an assignment! Anyhow...\nCreate an array of 10. Then create a for loop of ten and each time ask for the user for an input. Store that input to the array. Then using a loop again output the array to the listbox
448114
In C++ you should do this:
431775
Using the odd/even integer syntax\n\ncreate a grid, numbering each of the blocks, and for all Odd number blocks, insert the command to add a star.\n\nAre you learning C++ in school?
814965
what c++ program are you referring to ...anyway the syntax is\n\n#include<iostream.h>\n#include<conio.h>\n...include all the header files here ..\n\nint count()\n  {\n     function body\n     return value #integer value to be returned \n\n  }\n\nother functions\n\nvoid main() \n\n   {\n\n# this is the main function \n\nint a,b,c;\nfloat al,bl;\nstring str;\n\n#declare the variables\n\n#get the inputs from the user\ncout<<"enter the value of a ";\ncin>>a;\n...\n...\n\ncall the functions\n\nb=count()\n..\n#do what ever processing has to be done\n } # program closing curly braces\n\n\nhope this helps\n\nthis is a excellent c++ tutorial \n\nhttp://www.geocities.com/sstutor\n\ncprogramming.com is also pretty good
658966
I searched online and it looks like a program called VCDGear could do it. Check out the source link below and hopefully this will solve it for you.
444754
This sounds like school work, its a fairly simple program. you will probably want to use the cout and cin function which needs you to include iostream.h \n\nsimply use cout to print to screen, ask for input etc. then take the input using cin and store it to a int variable.\n\na good way to do it would be to ask the user what they wish to do, eg subtract, divide and take that operator first, a symbol or a number to show choice. then the next line asks for the numbers to be input.\n\neg:\n\n---------\n\nHello. what do you wish to do:\n1 - subtract\n2 - divide\n3 - etc etc\n\n>\n\n-------------\n\nthen use an if function or maybe a switch to check what their input was and do the artithmatic.\n\nso a very basic prgram may look like this:\nit may have errors i havant checked it.\n\n-----------------\n\n#include <iostream>\n\nint main() \n{\nint number;\n\n    cout << "Hello, input a number" << endl;\n    cin >>number;\n    return 0;\n}\n\n------\n\nEDIT; i re read the req, you might find inputting the selection to a char better, then check the char to see what symbol is stored in it, eg + / -. and maybe use a char array for the number input. simple take the char array, check for the space. split the numbers into 2 and caste then to an int. sounds complicated but it isnt to hard.\n\nsorry about spelling mistakes.
1174010
Buy a book. Online tutorials never helped me. I bought C++ for dummies. Its not bad.
505044
Try Planet Source Code:\n\nhttp://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=3270&lngWId=3\n\nThis one's in C++, but you should be able to convert it back to C...
635623
I don't know C++. But You can do it by sending  the text in to prn folder. Same thig you can do it in DOS type a.txt >prn