we are suppose to write a nice display code for natural numbers in Resolve its OSU version of C++, everytime I enter code and compile it though i get this error?

heres my code

concrete_instance
class Queue_Of_Naturals:
    instantiates Queue_Kernel_1a_C <Natural_Put_To_With_Commas_1>
{};
 
concrete_instance
class Sequence_Of_Queue_Of_Naturals:
    instantiates Sequence_Kernel_1a_C <Queue_Of_Naturals>
{};
 
 
///------------------------------------------------------------------
/// Interface -------------------------------------------------------
///------------------------------------------------------------------
 
/*!
    math operation SPACES (
            i: integer
): string of character
        implicit definition
            if i <= 0
            then SPACES (i) = empty_string
            else SPACES (i) = " " * SPACES (i-1)
   
    math operation NUMBER_OF_DIGITS (
            n: NATURAL_MODEL
): integer
implicit definition
            if n < 10
            then NUMBER_OF_DIGITS (n) = 1
            else NUMBER_OF_DIGITS (n) = 1 + NUMBER_OF_DIGITS (n DIV 10)
 
    math operation DISPLAY_WIDTH (
            n: NATURAL_MODEL
        ): integer
        implicit definition
            if n < 10
            then DISPLAY_WIDTH(n) = 1
            else DISPLAY_WIDTH(n) = NUMBER_OF_DIGITS(n) + ((NUMBER_OF_DIGITS(n) - 1) DIV 3)
!*/
 
//-------------------------------------------------------------------
//-------------------------------------------------------------------
 
global_procedure Display_Spaces (
        alters Character_OStream& output,
preserves Integer i
    );
    /*!
        requires
            i >= 0  and
            output.is_open = true
        ensures
            output.is_open = true and
            output.ext_name = #output.ext_name  and
            output.content = #output.content * SPACES (i)
    !*/
   
//-------------------------------------------------------------------
 
 
global_procedure Create_Display_Representation (
        alters   Character_IStream& input,
        produces Sequence_Of_Queue_Of_Naturals& s,
        produces Integer& display_width
    );
    /*!
        requires
            input.is_open = true and
            input.content = [a sequence of one or more natural number values,
                            one per line, as in
                            n0'\n'
                            n1'\n'
                            ...
                            nk'\n']
        ensures
            input.is_open = true and
            input.ext_name = #input.ext_name and
            input.content = empty_string and
            [display_width = DISPLAY_WIDTH(n0) and
             s = <s[0], s[1], s[2], ..., s[display_width]>
                 where (for 1 <= i <= display_width, s[i] consists exactly of the
                        natural numbers n, from #input.content, such that
                 DISPLAY_WIDTH (n) = i and the natural numbers
                 in s[i] appear in the same relative order, from left-to-right,
                 in which they appeared in #input.content)
     !*/      
   
 
 
//-------------------------------------------------------------------
 
 
global_function Integer Display_Width (
        preserves Natural_Put_To_With_Commas_1& n
    );
    /*!
        ensures
            Display_Width = DISPLAY_WIDTH (n)
    !*/
   
 
//-------------------------------------------------------------------
//-------------------------------------------------------------------
 
 
procedure_body Display_Spaces (
        alters Character_OStream& output,
preserves Integer i
    )
{
 
    object Integer number_displayed;
   
    while (number_displayed < i)
    {
output << ' ';
number_displayed++;
    }
}
 
//-------------------------------------------------------------------
 
procedure_body Create_Display_Representation (
        alters   Character_IStream& input,
        produces Sequence_Of_Queue_Of_Naturals& s,
produces Integer& display_width
    )
{
 
  object Natural_Put_To_With_Commas_1 n;
  object Integer x;
  object Queue_Of_Naturals Q, temp;
 
  while(not input.At_EOS())
  {
      input >> n;       
      if(Display_Width (n) > display_width)
      {
          display_width = Display_Width (n);
      }
      temp.Enqueue(n);
  }
  while(x <= display_width)
  {
      s.Add(x, Q);
      x++;
  }
  while(temp.Length()>0)
  {
      temp.Dequeue(n);
      s[Display_Width(n)].Enqueue(n);
  }
   
}
 
 
//-------------------------------------------------------------------
 
function_body Integer Display_Width (
        preserves Natural_Put_To_With_Commas_1& n
    )
{  
 
    object Integer k = n.Discrete_Log();
 
    if (n.Discrete_Log() == 0)
    {
return 1;
    }
    else
    {
k = k + ((k-1) / 3);
return k;
    }
}
 
//-------------------------------------------------------------------
//-------------------------------------------------------------------
 
program_body main ()
{
    object Character_IStream input;
    object Character_OStream output;
    object Sequence_Of_Queue_Of_Naturals s;
    object Integer working_display_width, pos;
 
    // Open input and output streams
   
    input.Open_External ("");
    output.Open_External ("");
 
   
 
    // get naturals from stream and organize them for output
   
    Create_Display_Representation (input, s, working_display_width);
 
    // now do a NICE_DISPLAY of the natural numbers in s.  In a NICE_DISPLAY of s,
    // first output all natural numbers in s[1], then all natural numbers in s[2],
    // then all natural numbers in s[3], ..., and finally all natural numbers in
    // s[working_display_width].  When outputting the natural numbers in s[1],
    // display each natural number on a separate line, right justified, with commas,
    // in a display field of total width working_display_width + 1.  Also, output the
    // natural numbers in the same order in which they appear in s[1].  Do the same
    // when outputting all natural numbers in s[2], s[3], and so on.  Feel free to take
    // a look at the test driver for closed lab 9 to get some ideas on how to proceed.
 
    pos = 0;
    while (pos < s.Length ())
    {
 
        object Natural_Put_To_With_Commas_1 n;
 
while (s[pos].Length() > 0)
{
 
            s[pos].Dequeue(n);
            Display_Spaces(output, 1 + working_display_width - Display_Width(n));
            n.Put_To_With_Commas(output);
            output << "\n";
           
}
 
pos++;
 
 
            }
   
    // Close input and output streams
   
    input.Close_External ();
    output.Close_External ();
}

It's a "hard space" that you probably copied in from a web page by mistake. Either find the line that it is on and put the cursor on the beginning of each space, hit delete to clear it then hit spacebar (do that for each one) -or- copy the program into Notepad, save it as ASCII and reload it into your IDE.

By the way, what dialect of C++ is this again? Never seen it before.

By the way, what dialect of C++ is this again? Never seen it before.

Nevermind I looked it up. Scary, moreso even than C++/CLI.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.