How do you check if a spot in a char array has a character there or not (C++)?
967124
char* or char[ ] types typically use a char value of 0 to mark the end of the string.\n\n however, "cout" will stop at this 0 automatically, so you obviously do not have a 0 at the end of the string.\n\n the best bet would be to not use a char* or char[ ] type at all, but use a STL::string type.  research the C++ standard tempalte libraries.  it has a string type with everything built in.\n\n  if you must use char* or char[ ], initialize your array to all 0's and never use the final size'd spot.  this is clumsy C programming though, not C++.  Use the STL in C++, it prevents many bugs.
942085
u can do alt + 3 = ♥\nor <3\n\nxox <3 <3 ♥♥♥♥ <3 <3
2853
I always recommend Bjarne Stroustrup's "The C++ Programming Language", third edition.  It cuts straight to the meat of what is different between C and C++ instead of messing around with arrays of char like most tutorials do.
60802
"disp" or "display" functions\n"line" is helpful too\n\nTry to make a string x='*****' y='** **' \ndisp x,y \nETC....
382045
Maybe you could make a method to remove certain characters from a string like string removeChars( string in, string chars )\n\nThe first param is the string you want to change and the second is the characters that you want to remove from the string. The method would use a for loop that loops through the chars string and in the for loop you would have a while loop that keeps on looping while the input string contains the character in the chars string at the index of the for loop. I don't think I said that very well, but the code might look like this:\n\nstring removeChars( string in, string chars );\n{\nfor ( int i = 0; i < chars.length(); i++ )\n{\nchar theChar = (chars.c_str())[ i ];\nint f = in.find_first_of( theChar );\nwhile ( f != -1 )\n{\nin.replace( f, 1, "" );\n}\n}\n\nreturn in;\n}\n\nThen, somewhere else in the program, you could call it like this: string cleanString = removeChars( "(in}[)]", "(){}[]" ); Then cleanString would equal "in".
129223
What are you comparing (characters, numbers, ...)?\nHow do you want to compare it (greater than, less than, equal to, ...)?\n\nThe basic structure is,\nif ([Object1] opperator [Object2])\n{\n//code to be executed if true\n}\n\nObject1 and Object2 are the elements of the array you want to compare.  The opperator is how you want to compare them,  for example, == or > or < or != or <= and so on.
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.
785470
There are numerous ways to do that. \nHere is, probably the simplest:\n\nchar *s="char *s=%c%s%c;%cmain() {printf(s,34,s,34,10,10);}%c";\nmain() {printf(s,34,s,34,10,10);}\n\nThe program itself is fairly useless.\nThe whole point of an exercise like this is the satisfaction of finding a solution yourself. Too bad, you did not give yourself a chance
674903
good answers, but there can also be multiple answers instead of just yes and no.\n\nfor instance, what day is today?\n\nif (day == monday)\n   cout<<"monday";\nelse if (day == tuesday)\n   cout<<"tuesday";\nelse if (day == wedensday)\n   cout<<"wedensday";\n...\nelse \n   cout<<"invalid entry";\n\nof course you could also use a case statement in this example, and would work the same.
1011128
Please post the snippet of code that does not work. In general, you need to check an array's length before yo uaccess its elements - it's called defensive programming, and good programmers should employ it.
161686
Easy if you restrict to integer types.\n\nCreate the following macro:\n\n#define IS_SIGNED(type) (((type) 0xFFFFFFFF) < 0)\n\nYou can now use it direction in your code as such:\n\nif (IS_SIGNED (char))\n{\n   stuff if it is signed\n}\nelse\n{\n   stuff if it is unsigned\n}\n\nNote that this implementation assumes that you maximum integer type is 32 bits. Pretty easy to change if it is otherwise though.\n\nI have done a LOT of multiple-platform code, char signing and byte ordering are the two biggest headaches.\n\nHope this helps.
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}
564045
http://www.gaurang.org/programs/\n\nsearch for infix and postfix on this page
253461
®\nuse ascii:\n\n\n<p>& # 1 7 4 ;</p>\nwithout the spaces
374089
It has 2-bytes code, so you need to examine two consequent bytes. It is not C++ specific, it is PC-specific.
300546
The two bars afterwards are ascii characters that reprsent cariage returns or it tells them when the enter key was pressed.  Such as:\n\nThis here | would be\n\nThis here\nwould be\n\nSo you would have to input the test file into a string and then parse out the | with a valid carriage return character before applying it to the text box.  Hope this helps.
943372
u have to ponit it or use\n\nthese are the 2 way's:\n\n#include <iostream>\nusing namespcae std;\nint main()\n{\nint num[8];\nint index;\n\nnum[0] = 42;\nnum[1] = 2001;\nnum[2] = 7;\nnum[3] = 180;\nnum[4] = 99;\nnum[5] = 1993;\n\nfor(index = 0; index <= 5; index++)\n{\nstd::cout<< index[num] << endl;\n}\n system("pause");\nreturn 0;\n}\n\nor\n\n#include <iostream>\n#define MAX 20\nusing namespcae std;\n\nint main()\n{\n\nint a[MAX] = {23,43,4,5,34,343,12,14};\nint b;\n\ncout.setf(ios::right);\n\nfor(b = 0; b < MAX; b++){\n\ncout << endl << endl;\n\ncout << "The Elemnt in ";\n\ncout.width(2);\n\ncout << (b +1) << " is ";\n\ncout.width(2);\n\nstd::cout << b[a];\n}\nreturn 0;\n}