You are here:

C++/Problem with arrays

Advertisement


Question
Hi again, i have a problem with a program i have to make, the thign is I didnt study much or practice when i had too, and no with have problems
with the key to my success...programming.
well I have to make a program which saves 5 salaries on an unidemonsional array...then multiply the salaries for a discount and print the final salary and the discounted money...this is wat i have so far

#include <stdio.h>

#define DESC 0.125
#define SAL 4



int salario[SAL], cont, a;
void main ()
{
  printf("Introduzca los salarios:\n");
  for (a=0; a<=4; a++){
  scanf("%d", &salario[a]);

  }
salario[a]*DESC;
for (a=0; a<=4; a++){
printf("salarios: %d\n", salario[a);
}
}

Answer
Hi,
 Hope that this would help.

Regards,
RaiD

int salario[SAL], cont, a;
int main ()
{
  printf("Introduzca los salarios:\n");
  for (a=0; a<=4; a++){
     scanf("%d", &salario[a]);

  }
/*   salario[a]*DESC; */
  for (a=0; a<=4; a++){
    printf("salarios: %d\n", salario[a]*DESC);
   }
  return 0;
}  

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Dharmender Rai

Expertise

I can answer general and system level C/C++ questions.

Experience

I have 5 years of experience in C++.

©2016 About.com. All rights reserved.