Homeworks must be delivered at the deadline date and hour.
- (100 points)
Our second homework is about text justification. http://www.m-w.com/cgi-bin/dictionary?justify - - - text can mean different things, but here we consider "justification on both sides", or "double justification", where text lines are justified both on the left and on the right. That is, all lines except (usually) the last one have equal width; the method used to achieve that is typically to leave extra space between words as needed. Such justification is very common in books and other printed matter and often regarded as an essential property of quality printing.
Rules :
1. Each line should start and end with an alphanumeric letter unless there is only one word in the line.
2. Each line length should be equal to the user specified length.
3. A word shouldn’t be broken into two parts.
4. The white space should be distributed in a balanced way.
Below you should find a starter code, with examples following. I want you to write a report which explains your solution and gives examples of your output. Also submit your code through moodle.
/* Homework assignment 2 */
/* Written by */
#include <stdio.h>
#include <ctype.h>
#include <string.h>
void main() {
char sstr[] = " ModelSim provides an Integrated Debug Environment that facilitates efficient design debug for SoC and FPGA based designs. This GUI has continuously evolved to include new windows and support for new languages. This application note aims to give an introduction to the ModelSim 6.0 debug environment. This environment is trilingual supporting designs based on VHDL, Verilog (all standards including SystemVerilog, Verilog 2001 and Verilog 1995), and SystemC. Subsequent releases of ModelSim will enable even more debug capabilities supporting higher levels of abstractions for verification and modeling in SystemVerilog and SystemC. In ModelSim 6.0, the GUI has been enhanced and is based on Multiple Document Interface (MDI) layout standard. In addition, the debug windows have been re-organized in such a way as to display design data and simulation results in an intuitive manner.";
int twid;
int slen = 0;
slen = strlen(sstr); // Length of the input string
//printf("\nlen :%d\n", slen);
printf("Enter text width :");
scanf("%d",&twid);
//printf("\nText Width %d",twid);
}
------------- elfdlbz
|