ı am from fatih university from turkey.now according to our country'time zone :03.01 am. and ı am still contınue working but ı couldn't solve the problem for 8 days.and there is a little bit time to handle homeworks.if one of you can help me to do my homework ı will really appreciate.ı have written 3 different code from different perspectives.but none of them is working.can you help me?god bless you!!!

and assignment link is here:

thank you very very very much!!!

11 Years
Discussion Span
Last Post by Ancient Dragon

did you bother reading this thread ? Its nearly identical assignment -- in fact that poster could also be in your class!

I have already done that assignment in C and C++, but I'm not about to post the results -- wouldn't want to spoil your fun :mrgreen: I did both programs the way I explained in the other thread.


yes ı think so they are same but after ı had posted ı realized. also he is one of my class mate.there are lots of forum in turkey that explain c programming in turkish but we meet here.isn't it strange?this homework make me crazy and you a bit:)thank you very much


ı did most of the things that you have mentıon
but code doesn t work parameters and comment lines are written in turkish.so it make no sense
.can you send me source code of the program ı really need help ı am not sleeeping for 25hours and ı will throw my computer away from window.. ı have 3 midterm exam the other week etc ...etc ... etc..the last thing that ı can do.


I don't know what code you are talking about that is in turkish -- that other thread contains no such code. If you are turkish_girl then why can't you read it? Post the code you have (in English please) and we'll try to help you out. I know all about those looooong hours, that's just the nature of the beast.


ı did my homework and posted today...you are not the only person who can programming...isn't it...

#include <stdio.h>
#include <ctype.h>
#include <string.h>
#define SIZE 200
void stringfunction(char *boundry, int twidth);//function prototype
int next_one(char *ptos);//function prototype

void main()
int twid;
int slen = 0;
int wlen, now;
now = 0;//number of words

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.";
char *ptos = sstr;
char boundry;

slen = strlen(sstr); // ıt calculates length of the whole string in sstr

printf("Enter text width :");

//we are controlling the number of character that a line have to consist of
//it provide us to enter a true value
if ((twid < 1) || (twid > SIZE))
printf("Please enter an integer between 1 and SIZE\n");


while(*ptos != '\0')//here to do a calculation there have to be character.if there is no
//we can not process further
while(*ptos == ' ') // here we are skipping all the white space characters

wlen = next_one(ptos); //it will calculate the length of the words in the fuction

if (wlen == 0) //controlling whether word has at least one character
// if there is no it terminates

if (now == 0)
memset(boundry, 0, sizeof(boundry));//firstly we are filling with 0.
strncpy(boundry, ptos, wlen); // copying the first word to boundry
else if (((int)strlen(boundry) + wlen + 1) <= twid)//controlling 1 space character
// number of character wlen includes and the new word whether fits the number of character
// at the beginning user enter
strcat(boundry, " ");       // appendding white space character to string
strncat(boundry, ptos, wlen); // appending word to boundry as much as the number of character
//word length include
else //
stringfunction(boundry, twid);  // arranging and printing
now = 0;

now++; // number of word
ptos+= wlen; //

stringfunction(boundry, twid);// Format string and string output


void stringfunction(char *boundry, int twidth)
int n;// the length of string
char *ptos = boundry;

while(boundry[twidth-1] == '\0') //it wants to justify the line to right as much as possible
while ((*ptos != ' ') && (*ptos != '\0'))  //controlling there is white space character
//or NULL character

if (*ptos == '\0') //controlling NULL character
ptos = boundry;

n = strlen(ptos);//calculates the length

while(n != 0)
ptos[n] = ptos[n-1]; //justifying to right

*ptos = ' '; //adding white space character

while(*ptos == ' ')

printf("%s\n", boundry);

int next_one(char *ptos)
int n = 0;

while ((*ptos != ' ') && (*ptos != '\0'))//it is used to take the next word
//it receive the word with its previous NULL or white space character

return n;

Edited by happygeek: fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.