example program of magic square in c language?
103536
Homework? :-)\nSee the link to the source below.
172063
http://www.thefreecountry.com/compilers/cpp.shtml
253406
All you need to program in C++ is a compiler and notepage.\n\none of the more popular is located here: \n  http://www.delorie.com/djgpp/\n\nAs for examples there's TONS on the Net, a simple Google Search for 'C++ examples'  returned over 32,000 hits.
604143
here is a program for 10 numbers in ascending order\n\n#include <iostream.h>\n#include <conio.h>\n\nvoid main()\n{\nclrscr();\nint array[10],t;\nfor(int x=0;x<10;x++)\n{\ncout << "Enter Integer No. " << x+1 << " : " << endl;\ncin>>array[x];\n}\nfor (x=0;x<10;x++)\n{\nfor(int y=0;y<9;y++)\n{\nif(array[y]>array[y+1])\n{\nt=array[y];\narray[y]=array[y+1];\narray[y+1]=t;\n}\n}\n}\ncout << "Array in ascending order is : ";\nfor (x=0;x<10;x++)\ncout << endl << array[x];\ngetch();\n}\n\nThis program takes in the ten integers array[x] to be stored in the single-dimensional array as a screen input from the user.\nIt then sorts out these ten integers into ascending order and prints them out using the 'cout' command.
491475
Have your seen the "Game Programming Beginners Guide" http://www.gamedev.net/reference/programming/features/davegpg/\nI not used this class library, but you should look for a \ngame class library. \nTheatrix: A C++ Game Class Library\nhttp://www.ddj.com/184409695
8922
You can make such a program by following the links given below :\n\nhttp://www.apollowebworks.com/russell/java/lattice.html\nhttp://www.mathsteacher.com.au/year7/ch01_whole/04_mult/mult.htm\n\nAlso, there is a program in the book Programming in C by Brian Tussle
384062
It is named "magic square" and they are very well investigated.\nExapmple of it's history and other information is, for example, in the first attached wiki article.\n\nThere are 275,305,224 such 5x5 squares.\nMethods for building them can be found in a references of this wiki article.\nFor example, 2nd attached URL is a link to an application, which can generate you a lot of them.\n\nNow, some examples:\n\n01 02 17 23 22\n19 15 08 16 07\n20 14 13 12 06\n21 10 18 11 05\n04 24 09 03 25\n\n\n01 02 17 23 22\n20 16 08 15 06\n19 12 13 14 07\n21 11 18 10 05\n04 24 09 03 25\n\n\n01 02 17 23 22\n20 16 08 15 06\n21 12 13 14 05\n19 11 18 10 07\n04 24 09 03 25\n\n\n01 02 17 23 22\n21 15 08 16 05\n19 14 13 12 07\n20 10 18 11 06\n04 24 09 03 25\n\nand so on
671787
There is a C language tutorial available on the net.It is available in PDF format.You can search for it on yahoo search.
397803
/*\n\ni need to know an example of writting a program in c\nlanguage under linux using threads?\n\nwrite aprogram to calculate the result of the equation\nY=3sin(x)+6cos(x)+5x2 so each term accomplished by a\nthread. The main thread will calculate the result.\n\n*/\n\n\n#include <pthread.h>\n#include <math.h>\n#include <stdlib.h>\n#include <stdio.h>\n\n/* static global location -- all threads will read */\nstatic double x;\n\nstatic void*\nthree_sinx(void*p)\n{\n  double* result = (double*)p;\n  *result = 3 * sin(x);\n  return 0;\n}\n\nstatic void*\nsix_cosx(void*p)\n{\n  double* result = (double*)p;\n  *result = 6 * cos(x);\n  return 0;\n}\n\nstatic void*\nfive_x_squared(void*p)\n{\n  double* result = (double*)p;\n  *result = 5 * x * x;\n  return 0;\n}\n\n/*\n *\n * Y = 3sin(x) + 6cos(x) + 5x2\n *\n */\n\nint\nmain(int argc, char* argv[])\n{\n  double result[3]; /* one location for each thread */\n  pthread_t tid[3];\n  void *r;\n  int i;\n\n  /* Set "x" to double value passed in on command line */\n  x = argc>1 ? strtod(argv[1], 0) : 0;\n\n\n  /*\n   *  Since result areas are distinct, no mutex needed\n   */\n  if (pthread_create(&tid[0], NULL,\n    three_sinx, &result[0]) != 0) {\n    perror("pthread_create[0]"), exit(-1);\n  }\n\n  if (pthread_create(&tid[1], NULL,\n    six_cosx, &result[1]) != 0) {\n    perror("pthread_create[1]"), exit(-1);\n  }\n\n  if (pthread_create(&tid[2], NULL,\n    five_x_squared, &result[2]) != 0) {\n    perror("pthread_create[2]"), exit(-1);\n  }\n\n  /* Synchronize on the completing child threads */\n  for (i=0; i<3; i++) {\n    if (pthread_join(tid[i], &r) != 0) {\n      perror("pthread_join");\n      exit(-1);\n    }\n  }\n\n  /* main thread will now combine the result */\n  printf("For y=3sin(x)+6cos(x)+5x2, when x=%f, y=%f&#92;n",\n      x, result[0]+result[1]+result[2]);\n\n  return 0;\n}\n\n\n\nTo show that it works:\n\n$ cc pthr.c -lpthread -lm\n\n$ a.out 3.14159\nFor y=3sin(x)+6cos(x)+5x2, when x=3.141590, y=43.347947\n\n$ a.out 0\nFor y=3sin(x)+6cos(x)+5x2, when x=0.000000, y=6.000000
346423
check out http://www.planet-source-code.com - I don't do C++, but I use that site all the time, and it has great examples in source code form.
750295
check out http://www.planet-source-code.com for examples.  I don't do C, but I use that site all the time.
215198
Some websites are : \n\nhttp://130.94.234.233/DM/html-ou/MagicSquares.htm \n\nhttp://www.geocities.com/~harveyh/
966120
try this stuff... pls understand the logic...\n\n#include<stdio.h>\n\nint main()\n{\nint no,rem;\nscanf("%d",&no);\nwhile (no)\n{\nrem = no % 10;\nprintf("%d",rem);\nno = no / 10;\n}\n}
849879
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);}
1110691
Here is something I came up with quickly ( not fully complete, I will leave that to you ! ) \n\nThis quick bit of code will give you a start ( hopefully and no recursion ).\n\nPlease note that this is not complete and you will get a memory leak in swap function ( easily fixed btw ! ).\n\n#include "stdafx.h"\n#include "stdio.h"\n#include "string.h"\n\nvoid manipulate( char* pString, int index );\nchar* swap( char* pString, int pos );\n\nchar pod[255];\n\n\nint main(int argc, char* argv[])\n{\n\n  char* p = "abc";\n  memcpy( pod, p, strlen( p ) );\n  for( int i = 0; i < strlen( p ); i ++ )\n  {\n    manipulate( pod, strlen( p ) );\n  }\n  return 0;\n}\n\n\nvoid manipulate( char* pString, int index )\n{\n  int i = 1;\n  char* p;\n  p = pString;   \n  while( index > 1 ) \n  {\n    p = swap( p, i );\n    index--;\n    i++;\n    memcpy( pod, p, strlen( pString ) );\n    printf( "%s&#92;n", p );\n  }\n}\n\nchar* swap( char* pString, int pos )\n{\n  char* p = new char[ strlen(pString) + 1 ];\n  memset( p, '&#92;0', strlen( pString ) + 1);\n  memcpy( p, pString, strlen( pString ) + 1 );\n  char temp = p[pos];\n  p[pos] = pString[pos-1];\n  p[pos-1] = temp;\n  return p;\n}
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?
1161264
The above answerer is slightly wrong.  C++ holds a subset of C, it is not the complete C language.\n\nApart from that, You should be able to get a program that executes in C, not in C++.\n\n/* hello.c -- The most famous program of them all ..\n */\n\n#include <stdio.h>\n\nint main(void) {\n  printf("Hello World!&#92;n");\n}\n\nGot from http://www.cis.temple.edu/~ingargio/cis71/code/hello.c