CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Threaded View

  1. #1
    Join Date
    Oct 2015
    Posts
    1

    Need help with Pascal program on array

    Need help in making a program for a meal plan and adding meal cost and displaying that information. I need to store number of guests in an array with their name and meal typy 'V' for vegetarian and 'N' for non vegetarian , this data must me stored in an array . can anyone help me to complete this program, m sort of stuck this is what i have so far .

    Program WeddingGuests (input,output);
    Var
    mealpreference:array[1..500]of char;
    guests:array[1..500] of string;
    costV:real;
    costN:real;
    totalguest:integer;
    g:integer;
    i:char;
    V:char;
    N:char;
    Begin
    Writeln('Enter total number of invited guests');
    Readln( totalguest);
    For g:=1 to totalguest do
    Writeln ('enter meal preference');
    Readln ( i);
    If( i ='V') OR (i = 'N') then
    mealpreference[g]:= i
    Else
    Writeln('invalid meal type re-enter until valid');
    End.{end else}
    End;{endif}
    End;{end for}
    If (i:='V')then
    costV:= costV * 35
    Else
    (meal preference:='N') then
    costN:= costN * 40
    End; {endif}
    End; {end else}
    Total cost :=costN + costV
    Writeln('Enter name of guests')
    Readln (guest)
    If (guests[g] <> guests) then
    Wrieln('sorry your name does not appear leave!')
    Else
    Writeln('Welcome to the wedding please enjoy!')
    End; {endif}
    End; {end else}
    End.
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured