4 Replies - 236 Views - Last Post: 20 February 2013 - 04:34 PM Rate Topic: -----

#1 dvarks  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 19-February 13

Nothing on the screen

Posted 19 February 2013 - 07:51 PM

#include "stdio.h"
#include "conio.h"
void menu();
void srm();
void cuadrado();
void comp();
void impnum();
void sumimp();
void prom();
char op;
int i;
float a,b,c,d,e,n,p,ab;
main()
{
      do
      {
                       void menu();
                       switch(op)
                       {
                                 case'1':srm();break;
                                 case'2':cuadrado();break;
                                 case'3':comp();break;
                                 case'4':impnum();break;
                                 case'5':sumimp();break;
                                 case'6':prom();break;
                                 }
                                 }
while(op!='0');
}
void menu()
{
     printf("1: Sumatoria, Resta y Producto de dos numeros \n");
     printf("2: Cuadrado de un numero \n");
     printf("3: Comparacion de tres numeros \n");
     printf("4: Impresion de números del 1-100 \n");
     printf("5: Suma de numeros impares del 1 al 10 \n");
     printf("6: Promedio de 'n' numero de alumnos \n");
     printf("0: Terminar programa \n");
     printf("Teclee la tarea que desea realizar: \n");
     op=getch();
     }
void srm()
{
      printf("Teclea el primer valor: ");
      scanf("%f",&a);
      printf("Teclea el segundo valor: ");
      scanf("%f",&B)/>;
      c=a+b;
      d=a-b;
      e=a*b;
      printf("la suma es: %f \n",c);
      printf("la diferencia es: %f \n",d);
      printf("el producto es: %f \n",e);
      }
void cuadrado()
{
      printf("Teclea el valor: ");
      scanf("%f",&a);
      c=a*a;
      printf("Resultado: %f",c);
      }
void comp()
{
     printf("Introduzca el primer valor: ");
      scanf("%f",&a);
      printf("Introduzca el segundo valor: ");
      scanf("%f",&B)/>;
      printf("Introduzca el tercer valor: ");
      scanf("%f",&c);
      if(a!=b && a!=c)
      
      if (a>B)/>
              
              if(a>c)
              printf("a es el maton");
              else
              printf("c es el jefe");
                         
              else
              
              if(b>c)
              printf("b es el mero mero");
              else
              printf("c rifa");
              
      
      else
      printf("teclea valores diferentes ");
      }
void impnum()
{
     i=1;
     while (i<=100)
     {
           printf("%f \n",i);
           i=i+1;
           }
           getch();
           }
void sumimp()
{
      a=0;
      b=1;
      while (a<10 && b<10)
      {
            a=c;
            c=a+b;
            b=b+2;
            }
      printf("%f",c);
      getch();
      }
void prom()
{
     a=0;
      d=0;
      printf("Numero de alumnos: ");
      scanf("%d",&n);
      while(a<n)
      {
                printf("Calificacion: ");
                scanf("%f",&B)/>;
                c=b+d;
                p=c/n;
                d=c;
                a=a+1;
                }
                printf("%f",p);
                getch();
                }




Problem:
Whenever I run the program, Nothing happens on the black screen ( I dont know it's name).
What am I doing wrong?

note: Ignore the spanish bits...I live in mexico :red_indian:

Is This A Good Question/Topic? 0
  • +

Replies To: Nothing on the screen

#2 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2889
  • View blog
  • Posts: 10,010
  • Joined: 08-August 08

Re: Nothing on the screen

Posted 19 February 2013 - 07:56 PM

You aren't calling menu. You're redeclaring it. Does that compile?
Was This Post Helpful? 1
  • +
  • -

#3 dvarks  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 19-February 13

Re: Nothing on the screen

Posted 19 February 2013 - 08:12 PM

View PostCTphpnwb, on 19 February 2013 - 07:56 PM, said:

You aren't calling menu. You're redeclaring it. Does that compile?

I'm sorry, I don't understand. As you can see, I am fairly new to this
Was This Post Helpful? 0
  • +
  • -

#4 #define  Icon User is offline

  • Duke of Err
  • member icon

Reputation: 1306
  • View blog
  • Posts: 4,495
  • Joined: 19-February 09

Re: Nothing on the screen

Posted 19 February 2013 - 09:16 PM

When you call the menu function you don't need void in front of it.

015      do
016      {
017                       menu();
018                       switch(op)
019                       {


Was This Post Helpful? 1
  • +
  • -

#5 dvarks  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 19-February 13

Re: Nothing on the screen

Posted 20 February 2013 - 04:34 PM

View Post#define, on 19 February 2013 - 09:16 PM, said:

When you call the menu function you don't need void in front of it.

015      do
016      {
017                       menu();
018                       switch(op)
019                       {



Thank you very much!
It works now!!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1