Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7060069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:18:30+00:00 2026-05-28T04:18:30+00:00

I make code to display multiple pages (max. 5 lines/page) with persons from one

  • 0

I make code to display multiple pages (max. 5 lines/page) with persons from one list:

/* PRE:     page : number of the page we want to show, starting with 1
 * RETURNS: pagenumber of the page showing if there is one, 0 otherwise  */


const int buf_length = 255;
const int max_num_lines = 15;
const int num_person_per_page = max_num_lines / 3;
const int num_person = person_get_num_person(personmgr);
char buf[buf_length+1];
int i, count, cur = 0;

/* List Header */ 
snprintf(buf, buf_length, "List of person on page (%d/%d)):", page, num_person/num_person_per_page);
list_set_text( list, cur++, buf);
list_set_hilight(list, -1); 

If list have number of persons witch isn’t multiples of 5 (72 – in my example), list header of last page returns total number of page as 14 instead of 15 (14/15).

First page list header:

List of person on page: 1/14:
01. AAA
02. BBB
03. CCC
04. DDD
05. EEE

Second page list header:

List of person on page: 2/14:
06. FFF
07. GGG
08. HHH
........................

Last page list header:

List of person on page: 14/15:
71. XXX
72. ZZZ     

I want a to round up to next integer number (pages number to be displayed correctly).

72 / 5 = 14.4 => 15
70 / 5 = 14   => 14
36 / 5 = 7.2  => 8

First page list header:

List of person on page: 1/15:
01. AAA
02. BBB
03. CCC
04. DDD
05. EEE

Second page list header:

List of person on page: 2/15:
06. FFF
07. GGG
08. HHH
........................

Last page list header:

List of person on page: 15/15:
71. XXX
72. ZZZ
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:18:31+00:00Added an answer on May 28, 2026 at 4:18 am

    You can write (n + 4) / 5 to integrally compute the mathematical ceiling of n / 5: If n is already a multiple of 5 then you’re adding 4 / 5 == 0, and otherwise you’re adding 1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using CodeIgniter and I want to display a list of cities in multiple
I want to display all native contacts in a list and make user to
I'm utilizing the code posted by Jesper Palm here: Make user control display outside
I want to make a code snippet database web application. Would the best way
I have this web page I'm developing that displays multiple images of one product
my question is this: I have HTML code in multiple pages, on each of
I need to display multiple images for a a car from a separate linked
I need to make multiple asynchronous service calls in the application:didFinishLaunchingWithOptions: method from my
Sometimes a labeled break or continue can make code a lot more readable. OUTERLOOP:
According to the PHP manual , in order to make code more portable, they

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.