GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 01-Jul-2004, 15:19
awmp-jansen awmp-jansen is offline
New Member
 
Join Date: Jul 2004
Posts: 4
awmp-jansen is on a distinguished road

problem with the program under Borland


hi all


I have a problem with a function.I use Borland BTW.
Have a look at the program.

CPP / C++ / C Code:
#include <process.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <conio.h>

void affichage();
void affichage2();
void antivirus();
void firewall();


void main(int argc, char *argv[])
{
void affichage();
}

void affichage(int argc, char *argv[])
{
 int status,choix;
 status=0;
 do
  {
   printf("       *** MERCI D'UTILISER ''LUTINSOFT ANTINOOBVIRUS SUITE PRO'' ***\n\n");
   printf("  Veuillez choisir votre status:\n\n");
   printf("       1- Utilisateur NOOB au PC plein de Virus\n");
   printf("       2- Utilisateur pret a faire une LAN - virus inclus dans le PC\n");
   printf("       3- Utilisateur sans aucun virus LE GARS PARFAIT\n");
   printf("       4- Le Neophite qui s'est trompe de CD\n");
   scanf("%d",&status);
  }
 while(status<=0 || status>=4);

 if(status!=1)
  {
  printf("  Si vous utlisez ce CD c'est que vous mentez\n");
  printf("  *STATUS: Utilisateur NOOB au PC plein de Virus* Choisit par l'admin\n");
  }

 printf("  MERCI D'AVOIR ACCEPTE VOTRE STATUS\n\n");
 clrscr();
}


void affichage2(int argc, char *argv[])
{
 int i,choix,choix2;
 do
  {
   printf("  Que voulez vous faire: \n");
   printf("        1- Installer un Antivirus\n");
   printf("        2- Installer un Firewall\n");
   printf("        3- Autre Chose\n");
   printf("        4- Retour");
   scanf("%d",&choix);
  }
  while(choix<1 || choix>2);
  switch(choix)
   {
   case 3:{
           printf("       \n5- Se prendre une raclee a CS\n");
           printf("       6- Se faire remonter les bretelles a Starcraft Golem\n");
           printf("       7- Apprendre à jouer a Warcraft III\n\n");
           scanf("%d",&choix2);
           switch(choix2);
            {
            case 5: printf("Contacter: [email]awmp-jansen@wanadoo.fr[/email]");
            case 6: printf("Demander directement à Josua - Gosusaurus");
            case 7: printf("Demander à Bigmoustache - Predator_39");
            }
           }
    case 4:{
            clrscr();
            void affichage();  <===== BUG: declaration is not allowed here
           }

   }
 getch();
}
Last edited by dsmith : 01-Jul-2004 at 15:28. Reason: Please use [c] & [/c] for syntax highlightin
  #2  
Old 01-Jul-2004, 15:24
aaroncohn's Avatar
aaroncohn aaroncohn is offline
Regular Member
 
Join Date: Feb 2004
Location: Bay Area, CA.
Posts: 564
aaroncohn is a jewel in the roughaaroncohn is a jewel in the roughaaroncohn is a jewel in the rough
Before you read anything stated below, please visit this link:
http://www.gidforums.com/t-689.html

Delete the word void before your function call where you have the bug. Basically, you are re-declaring a function, and you're doing it with within the body of another function -- both of which are illegal actions. Only use a type specifier if you are instantiating a variable, specifying a return value for a function, specifiying a parameter type for a function header, or doing an explicit type-cast.
__________________
-Aaron
  #3  
Old 01-Jul-2004, 15:31
awmp-jansen awmp-jansen is offline
New Member
 
Join Date: Jul 2004
Posts: 4
awmp-jansen is on a distinguished road
i'am a real beginner in C.

When i take void out it says :
[C++ Error] install.c(83): E2193 Too few parameters in call to 'affichage'

what must i do then ?
  #4  
Old 01-Jul-2004, 18:05
dabigmooish's Avatar
dabigmooish dabigmooish is offline
Member
 
Join Date: May 2004
Location: Baltimore (middle of Canton)
Posts: 167
dabigmooish will become famous soon enough
I'm just gonna mark the errors I see. One question: Is this your complete code or only a section?
CPP / C++ / C Code:

#include <process.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <conio.h>

void affichage();
void affichage2();
void antivirus();
void firewall();


void main(int argc, char *argv[])
{
void affichage(); /*Don't need the void.  Your probally getting an error here.
Your also calling a function that recieves arguments without actually passing 
it any. */
}

void affichage(int argc, char *argv[])
{
 int status,choix; /*Your not actually using choice maybe because your codes not complete?????*/
 status=0;
 do
  {
   printf("       *** MERCI D'UTILISER ''LUTINSOFT ANTINOOBVIRUS SUITE PRO'' ***\n\n");
   printf("  Veuillez choisir votre status:\n\n");
   printf("       1- Utilisateur NOOB au PC plein de Virus\n");
   printf("       2- Utilisateur pret a faire une LAN - virus inclus dans le PC\n");
   printf("       3- Utilisateur sans aucun virus LE GARS PARFAIT\n");
   printf("       4- Le Neophite qui s'est trompe de CD\n");
   scanf("%d",&status);
  }
 while(status<=0 || status>=4);

 if(status!=1)
  {
  printf("  Si vous utlisez ce CD c'est que vous mentez\n");
  printf("  *STATUS: Utilisateur NOOB au PC plein de Virus* Choisit par l'admin\n");
  }

 printf("  MERCI D'AVOIR ACCEPTE VOTRE STATUS\n\n");
 clrscr();
}


void affichage2(int argc, char *argv[])
{
 int i,choix,choix2; /*You don't have choix and choix2 initilized before you use 
it in your do...while loop.   In this case I don't think you need too but its a 
good programming tip*/
 do
  {
   printf("  Que voulez vous faire: \n");
   printf("        1- Installer un Antivirus\n");
   printf("        2- Installer un Firewall\n");
   printf("        3- Autre Chose\n");
   printf("        4- Retour");
   scanf("%d",&choix);
  }
  while(choix<1 || choix>2);
  switch(choix) /*You don't have a default statement for this switch (what if 
choice is 0 or 200?) also you don't have any break statements so all of your 
cases will be executed in the order you have them(i.e. 3 then 4) agian I'm 
sorry if this is just do to the fact that you havn't finished coding. */
   {
   case 3:{
           printf("       \n5- Se prendre une raclee a CS\n");
           printf("       6- Se faire remonter les bretelles a Starcraft Golem\n");
           printf("       7- Apprendre à jouer a Warcraft III\n\n");
           scanf("%d",&choix2);
           switch(choix2); /*This colon is going to prevent this switch 
from "seeing" any of the cases. You also have the whole break statement 
problem again. */
            {
            case 5: printf("Contacter: [email]awmp-jansen@wanadoo.fr[/email]");
            case 6: printf("Demander directement à Josua - Gosusaurus");
            case 7: printf("Demander à Bigmoustache - Predator_39");
            }
           }
    case 4:{
            clrscr();
            void affichage();  <===== BUG: declaration is not allowed here
            /*don't need the void here either*/
           }

   }
 getch();
}



Hope all that helps you
__________________
"To argue with a person who has renounced the use of reason is like administering medicine to the dead."
-Thomas Paine
www.sullivan-county.com/deism.htm
 
 

Recent GIDBlogProgramming ebook direct download available by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with a C program (Long) McFury C Programming Language 3 29-Apr-2004 21:06
C I/O problem kelly80 C Programming Language 4 27-Apr-2004 21:15
Another problem dealing with main() and driver function tommy69 C Programming Language 4 20-Mar-2004 20:46
problem with borland compiler killer9012 C++ Forum 51 15-Mar-2004 15:21
error during program rjd72285 C++ Forum 0 11-Nov-2003 19:49

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 05:51.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.