| | |
a program i wrote and gives me all the time: POLINK: fatal error: Access is denied.
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Dec 2008
Posts: 1
Reputation:
Solved Threads: 0
a program i wrote and gives me all the time: POLINK: fatal error: Access is denied.
0
#1 Dec 15th, 2008
hallo i wrote a program with 3 different functions.
something wrong with her and i cant see it.
something wrong with her and i cant see it.
c Syntax (Toggle Plain Text)
#include<stdio.h> int devide9(int num); int decimal_binar(int num); int binar_decimal(int num); int main() { int menu, num9, numd1, numb1, numd2, numb2, numfinal1; printf("\nHallo these are your options:\n"); printf("1. Check if your number can be devide by 9 without residue.\n"); printf("2. Decimal - binar converter.\n"); printf("3. Binar - decimal converter.\n"); printf("4. Exit.\n"); scanf("%i", &menu); switch (menu) { case 1: printf("please enter a number:\n"); scanf("%i", &num9); numfinal1 = devide9(num9); if (numfinal1 == 9) printf("the number can be devided by 9.\n"); else printf("the number can not be devided by 9.\n"); main(); case 2: printf("please enter a number:\n"); scanf("%i", &numd1); numb1 = decimal_binar (numd1); if (numd1<0) printf("%i (base 10) => -%i (base 2)\n", &numd1, &numb1); else printf("%i (base 10) => %i (base 2)\n", &numd1, &numb1); main(); case 3: printf("please enter a number:\n"); scanf("%i", &numb2); numd1 = binar_decimal(numb2); if (numd2<0) printf("%i (base 2) => -%i (base 10)\n", &numb2, &numd2); else printf("%i (base 2) => %i (base 10)\n", &numb2, &numd2); main(); case 4: return(0); break; default: main(); break; } return(0); } int devide9 (int num) { int numT, num1; if (num<0) num = num*-1; numT = 0; while (num > 0 ); { num1 = num%10; numT = num1 + numT; num = num/10; } if (numT>9) numT = devide9 (numT); return (numT); } int decimal_binar (int num) { int counter, multi, i, numT, num1, numd1; if (num<=1023 && num >= -1023) { if (num<0) num = num*-1; counter = 0; numT = 0; while (num > 0 ); { num1 = num % 2; num = num / 2; if (counter == 0) numT = num1; else { multi = 1; for (i=1; i<=counter; i++) { multi = 10 * multi; } } numT = multi * num1 + numT; counter = counter +1; } } else { printf("please enter a new number:\n"); scanf("%i", &numd1); numT = decimal_binar(numd1); } return (numT); } int binar_decimal (int num) { int num1, counter, hez1, hezT, i,numT, numb1; counter = 0; if (num >= -1111111111 && num <= 1111111111) { if (num < 0) num = num*-1; counter = 0; numT = 0; while (num > 0 ); { num1 = num % 10; hez1 = hezT = 1; for (i=1; i<=counter; i++) { hez1 = hezT; hezT = hez1*2; } numT = num1*hezT + numT; counter = counter + 1; num = num / 10; } } else { printf("please enter a new number:\n"); scanf("%i", &numb1); numT = binar_decimal (numb1); } return (numT); }
Last edited by Narue; Dec 15th, 2008 at 12:16 pm. Reason: added code tags
Re: a program i wrote and gives me all the time: POLINK: fatal error: Access is denied.
0
#2 Dec 15th, 2008
Re: a program i wrote and gives me all the time: POLINK: fatal error: Access is denied.
0
#3 Dec 15th, 2008
•
•
Join Date: Nov 2008
Posts: 90
Reputation:
Solved Threads: 8
Re: a program i wrote and gives me all the time: POLINK: fatal error: Access is denied.
0
#4 Dec 26th, 2008
main() function cannot be called again and again.
Instead you can use another function in place of it or use
Instead you can use another function in place of it or use
C Syntax (Toggle Plain Text)
goto label;
Re: a program i wrote and gives me all the time: POLINK: fatal error: Access is denied.
0
#5 Dec 26th, 2008
•
•
•
•
main() function cannot be called again and again.
Instead you can use another function in place of it or use
C Syntax (Toggle Plain Text)
goto label;
•
•
Join Date: Nov 2008
Posts: 90
Reputation:
Solved Threads: 8
Re: a program i wrote and gives me all the time: POLINK: fatal error: Access is denied.
0
#6 Dec 26th, 2008
•
•
•
•
Use of goto is frowned upon. The only place where it's usage is justified is when you're in a nest of loops and wanna come out of it with the least amount of hassle. As Salem has already suggested, loop is the best way to go about this particular problem.
goto() statements is the last option to use in the program when nothing works.
![]() |
Other Threads in the C Forum
- Previous Thread: Please help me
- Next Thread: Random number generator
| Thread Tools | Search this Thread |
#include * ansi append array arrays asterisks bash binarysearch centimeter changingto char character convert copyimagefile cprogramme creafecopyofanytypeoffileinc database dynamic execv feet fgets file floatingpointvalidation fork framework function getlogicaldrivestrin givemetehcodez grade gtkwinlinux hacking histogram ide inches include incrementoperators infiniteloop initialization input interest intmain() iso kernel keyboard kilometer license linked linkedlist linux list lists locate looping lowest matrix meter microsoft number oddnumber opendocumentformat openwebfoundation overwrite owf pdf pointer posix power probleminc process program programming radix recursion recv recvblocked research reversing segmentationfault sequential single socket socketprograming socketprogramming standard strchr string suggestions systemcall test testing threads turboc unix urboc user variable wab whythiscodecausesegmentationfault windowsapi






