heads_1268 Posted May 4, 2008 at 03:33 PM Report Share #183292 Posted May 4, 2008 at 03:33 PM boas, eu tenho o seguinte codigo: #include <stdio.h> quantos_pro() { int n_pro; scanf("%d",&n_pro); return n_pro; } qual_tipo() { int qual_tipo,i; for(i=1;i<=n_pro;i++) scanf("%d",&qual_tipo); return qual_tipo; } soma_conta() { } main() { printf("*******************************************************************\n"); printf("******************************MENU COMPRAS*************************\n"); printf("*******************************************************************\n"); printf("*******************************************************************\n"); printf("****************produtos casa(C) ---------5euros/cada**************\n"); printf("****************produtos roupa (R)-------—3euros/cada**************\n"); printf("****************Produtos jardim (J)-------2euro/cada***************\n"); printf("****************Produtos acessorios (A)---1euro/cada***************\n"); printf("*******************************************************************\n"); printf("*******************************************************************\n"); printf("*******************************************************************\n"); printf("*******************************************************************\n"); printf("*******************************************************************\n"); int num_produtos ; printf("quantos produtos comprou?\n"); num_produtos=quantos_pro(); printf("qual/quais o/os tipo de produto\n"); qual_o_tipo_pro=qual_tipo(); switch() { case 'c': break; case 'r': break; case 'j': break; case 'a': break; default: printf("carecter introduzido incorrecto\ntem de escolher as opcçoes que estao no menu"); break; } } a minha pergunta e , na funçao qual_tipo como e que eu guardo em cada ciclo o tipo de produto. por exemplo: quantos produtos comprou: 5 qual o tipo: a,a,j,r,c como e que eu guardo estas variaveis a,a,j,r,c. obrigado Link to comment Share on other sites More sharing options...
Rui Carlos Posted May 4, 2008 at 03:37 PM Report Share #183293 Posted May 4, 2008 at 03:37 PM Num array, por exemplo. Rui Carlos Gonçalves Link to comment Share on other sites More sharing options...
heads_1268 Posted May 4, 2008 at 03:39 PM Author Report Share #183294 Posted May 4, 2008 at 03:39 PM Num array, por exemplo. nao percebi... Link to comment Share on other sites More sharing options...
Rui Carlos Posted May 4, 2008 at 03:53 PM Report Share #183295 Posted May 4, 2008 at 03:53 PM http://gd.tuwien.ac.at/languages/c/programming-bbrown/c_034.htm Rui Carlos Gonçalves Link to comment Share on other sites More sharing options...
heads_1268 Posted May 4, 2008 at 04:17 PM Author Report Share #183300 Posted May 4, 2008 at 04:17 PM http://gd.tuwien.ac.at/languages/c/programming-bbrown/c_034.htm obrigado Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now