if you use like that definitation
int square[n][n] that means you made a array static.So n must be const that does not matter you return a n value from any function.
i will make a dynamic aray declaration you can use
int **arary,row,col omn; // two asterix means you make two dimentional aray
than you will request memory (in C malloc, in C++ you can use new function)
array=new int*[row];
for(int...
User Profile
Collapse
-
parameters to main
hi
I wrote a program and that should takes some parameters when it is executed
like that
program.exe /s
and I wanna write if statements according to parameters but i could not.
for instance;
Code:#include<stdio.h> main(char c) { if(c=='s') func1(); // appropriate function else func2(); return 0;
-
-
calculate the horse's movement
hi guys,
the problemm is that you have a horse on the chess board.You should write a function that calculate the horse's movement.I mean how many movement later you can go every point on the board.I wrote that program and wanted to share with you...
I am Turkish so I named functions in Turkish.So it can make the source misunderstable sorry for that
//---------------------------------------------------------------------------... -
finally i managed to write that program thank to you.I will put that code here to help anyone who want to help about that problem.I wrote this problem for 3 *3 matris.It would be developed by using dynamic memory management
Code:#include<stdio.h> #include<conio.h> void find(int,int); long result=0; int matris[3][3]; int x,y; main() { int a,b; x=3;y=3; for(a=0;a<3;a++)
Leave a comment:
-
i add do while loop to your code
getche() function takes a character that will ask users request if user types e it loops again otherwise program will end...
i hope it was helpfull...Leave a comment:
-
if you select %e formatted that means you wanna print that floating point numbers format that save memory because of floating points.
3.142857e+000 that output means there isn't any sliding point i mean that if there is written -01 after 'e' the real number would be occur when you slide the point one time to left the following example will make clear
3.142857e+000=0 .3142857e-01
if the operator is '+' you need slide the dot...Leave a comment:
-
I wrote a programm that can help you i put the source if can't understand i will help you again
Code:#include<stdio.h> #include<stdlib.h> #include<string.h> #define SIZE 120 main() { int count=0; char name[SIZE]; char *reversed; reversed=(char *)malloc(strlen(name)+1); printf("please type a name that will be reversed\n");
Leave a comment:
-
thanks for your attention.
You realıy help me about which way i should focus onLeave a comment:
-
karan is true i would help you about finding a integer from the 2D arrays
you shold write 2 for loops and a if state like that
int search;
for(int i;i<size;i++)
for(int j;j<size;j++)
if(array[i][j]==search)
return 0;
can be......Leave a comment:
-
yeah you are true i wrote wrong i am sorry for that
actually i wanted to say we can go 2 or 4 from 1.But we can't go to 5 from 1 because it is diagonal way. The problem is that how many ways are there that go to 9.Starting point is 1. Sure we can't go same point on a way
for instance the following one is false
1236523 ( because we visit the 3 point twice so this one is false)
if you help me again i would be...Leave a comment:
-
could you help about algorithm
firstly hi,
i am new in this site
i have a problem to develop a algorithm about that
problem is that we should write a problem that can calculate the counts of ways 1 to 9 but we can't use diagonal way for instance we can't go 5 from 1. we can go 2 or 5 from 1
if you help me to develop a algorthm with c++ i would be happy
thanks...
No activity results to display
Show More
Leave a comment: