Below --> Program, Actual Output, and Desired Output:\n\nProgram:\nint main\n{\nstring names[3] = {"Smith, John", "Anthony, Mark", "Gibson, Mel"};\n\nbubble_sort(names[3]);\n\nfor(index=0; index<3; index++)\n    cout<<names[index]<<"&#92;n";\n}\n\nvoid bubble_sort(string& array)\n{\n      int i, j, flag = 1;\n      char temp;\n      int arrayLength = array.length( ); \n      for(i = 1; (i <= arrayLength) && flag; i++)\n     {\n          flag = 0;\n          for (j=0; j < (arrayLength -1); j++)\n         {\n               if (array[j+1] > array[j])\n              { \n                    temp = array[j];\n                    array[j] = array[j+1];\n                    array[j+1] = temp;\n                    flag = 1;\n               }\n          }\n     }\n     return;\n}\n\nActual OUTPUT:\nSmith, John\nAnthony, Mark\nGibson, Mel\n\n\nDesired OUTPUT:\nAnthony, Mark\nGibson, Mel\nSmith, John
214669
Several problems:\n\n>  bubble_sort(names[3]);\n\nthis is accessing the 4th element of the names array (first 3 elements are at indices 0, 1, and 2). this is why you're getting your output, it's not sorting anything! i'm surprised this program didn't crash. instead you simply want to pass 'names' as the parameter - this means you are passing the entire array as a parameter, not a single element of the array. proper:\n   bubble_sort(names);\n\n>           if (array[j+1] > array[j])\n\nthis would sort the array opposite the way you want it. simple fix is using less-than instead of greater-than. BUT, if i'm not mistaken, you can't compare strings like that. you have to use strcmp, like this:\n            if (strcmp(array[j+1], array[j]) < 0)\notherwise, you are just comparing pointers.
30134
How about using the char array that is the input string, converting to uppercase, then using the chars as indexes into your substitution array of chars? Use the ASCII table to help you.\n\nchar subst_array[] = {'Z', 'Y', 'X', ...};\n\nconversion to uppercase: if (char > 90) char -= 32;\n\nfor (i = 0; i < strlen(input_string); i++)\n  input_string[i] = subst_array[input_string[i] - 65];\n\ncout << input_string;
603068
void main()\n{\ncout<<"no"<<"/t"<<"id.no"<<"/t"<<"name"<<"/t"<<"sex"<<"/t"<<"department";\ncout<<"1 001/98 sarafcomputerscience&#92;n";\ncout<<"your information";\ncout<<"your information";\ncout<<"your information";\ncout<<"your information";\n\n}\nif u want to get input at runtime try to input thr cin>> statement and get that output by cout statement
472624
Create an array with the number of elements equal to the number of ascii characters in a 'full set' ("A" =65) array will be 255 long.Open your text file, bring each character in, then using the ascii value of the character, increment that ascii value in the array by one. (the last time I wrote 'C" was 12 yrs ago!) Little bit of imagination now, open file, read first character...what is it? convert to ascii, now array number chars ascii value goes up by one, readr next char, while not end of file. General structure, get the file, then to while(not eof) read first char, convert, increment array, back to top of while, (tests for eof) get char...etc, etc,,,
334431
The asterix indicate which dimension of the array should be output.\n\nprintf allows you to format the output string. Your printf string basically says, "Print four decimal columns. First column, give me the first dimension of the array; second, give me the second dimension; etc."\n\nThe asterixes are pointers. Each asterix indicates which position of the array the statement should output.
660525
Sequential search:\n\nhttp://cprogramming.com/discussionarticles/sorting_and_searching.html
18313
Go to the Dos prompt. There is a program called sort.\n\nSort [unsorted file name] > [sorted file name]\n\nIf you want to concatenate all your files together first, that's a bit more tricky:\n\nCopy [file name 1] ABC.Txt\nType [file name 2] >> ABC.Txt\nType [file name 3] >> ABC.Txt\n.\n.\nSort ABC.Txt > ABC.Srt
194458
It may be easier to use an array list.\n\n  Dim al As New ArrayList()\n\n   al.Add("This")\n   al.Add("Is")\n   al.Add("My")\n   al.Add("New")\n   al.Add("ArrayList")\n   al.Add("Control")\n\n   Console.WriteLine("Before Sort:")\n   WriteElements(al)\n\n   al.Sort()\n\n   Console.WriteLine("After Sort:")\n   WriteElements(al)\n End Sub\n\n Private Sub WriteElements(ByVal al As ArrayList)\n   Dim i As Integer\n   \n   For i = 0 To al.Count - 1\n     Console.WriteLine(CStr(al.Item(i)))\n   Next
483979
/*\nA simple program that calculates the LCD/LCM of two ints\nWITHOUT THE using GCD methode!!\nbtw, always write your own damn code lol!\n*/\n\nimport java.util.Scanner;\n\npublic class Program {\n\npublic static int lcm(int[] array) {\n\nint count = array.length;\nint X = array[0];\nint i = 0;\n\nwhile( true ) {\n\nif( (X % array[i]) == 0 ) {\nif( i >= count-1 )\nbreak;\ni++;\n}\n\nelse {\nX += 1;\ni = 0;\n}\n}\nreturn X;\n}\n\npublic static void main(String[] args) {\n   \nSystem.out.print("Enter two nonzero integers: ");\n    Scanner keyboard = new Scanner(System.in);\n    int[] array = new int[2];\n    for(int count = 0; count < 2; count++)\narray[count] = keyboard.nextInt();\n    System.out.println("LCD is: " + lcm(array));\n    }\n}
436488
for (int i = 0; i < arrayA.length; i++)\nfor (int j = 0; j < arrayA[0].length; j++)\n  arrayC[i][j] = arrayA[i][j] + arrayB[i][j];\n\nSystem.out.println("  Values for arrayC");\nfor (int i = 0; i < arrayC.length; i++)\n   for (int j = 0; j < arrayC[0].length; j++)\n   {\n      System.out.print(arrayC[i][j]);\n      if(j < arrayC[0].length - 1)\n        System.out.print("   ");\n      else\n        System.out.println("");\n  }
293934
#include <iostream.h>\n#include <conio.h>\n#include <process.h>\n\nmain()\n\n{\n\nchar c;\n\nclrscr();\ncout<<"Press 0 to exit&#92;n";\n\ndo\n{\n\n c=getch();\n\n switch(c)\n {\n   case '0': exit(0);\n   case '1': cout<<"I";break;\n   case '2': cout<<"L";break;\n   case '3': cout<<"o";break;\n   case '4': cout<<"v";break;\n   case '5': cout<<"e";break;\n   case '6': cout<<"U";break;\n }\n\n} while (1);\nreturn 0;\n}
453545
here you go...\n(it'll work with up to 255 different disks, if you need more, you'll have to replace chars with ints)\n\nm1(char *a,b) {memove(b+1,b,strlen(b)+1); *b=*a; memmove(a+1,a, strlen(a);}\nm(char *a,b,c) {if (*a)  {m(a+1,b,c);m1(a,c);m(b,c,a);}
51701
Ah, love these kinds of problems.\n\nOK, there is a very efficient solution if you restrict yourself to integer types. Try this code:\n\nint Answer = 0;\nint i;\nfor (i=0; i < 2*n + 1; i++)\n{\n   Answer ^= Array[i];\n}\nprintf ("Single entry is %d&#92;n", Answer);\n\nThe clincher here is that every integer when exclusive ORed with itself yields zero, so all of the duplicates simply disappear - you will only be left with the unpaired entry.
94786
#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}
517425
main() { static char *a="n0body"; char b[512],*c,*d;\n  while (c=gets(a)) for (d=a;c;*c^=*d,c++,d=*++d?d:a);\n  printf ("%s&#92;n",b);}\n\n\nhappy?
532781
I'll tell U something that could help in the reverse task\n\nU can use one of two things\n\n1-\nby includeing <string> & < algorithm>\n\nvoid revers(char* a,int length)\n{\n     string s = a;\n     reverse(s.begin() , s.end());\n     a = s;\n}\n\n2- \nby using a loop\n\nvoid reverse(char *a,int length)\n{\n     int i=0;\n     for(i=0;i< = (length/2) ;i++)\n          a[length-i-1] = a[i];\n}
199763
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.