c - Programmes won't run on Ubuntu 12.04 and Windows XP -


After assuming eclipse and CB, I found many projects that have not started properly. I assumed that this was due to the use of the OS, so I changed Ubuntu though, some programs that I still tried to run would not work properly. For example, nothing happens when clc-wiki enters this code:

  #include & lt; Stdio.h & gt; # Maxline 40 / * Define maximum input line size * / int gateline (four lines [], int maxline); Zero per (four to [], four to []); / * Longest input line * / int main () {int c; Int len; / * Current line length * / max maximum; / * Maximum length of time * / four line [MAXLINE]; / * Current input line * / longest [MAXLINE]; / * Longest line saved here * / max = 0; While (line = mg (line, maxline)) gt; {if (line [lane -1]! = '\ N') while ((c = getchar ())! = EOF & amp; = ' \ N ') ++ LAN; If (LAN> Max) {max = len; Copy (longest, line); }} If (max> gt; 0) {/ * one line * / printf ("The longest row with% d characters: \ n", max); Printf ("% s ... \ n", longest); } Return 0; } / * Returns: read a row, return length * / integer errors (four s [], integer lim) {int c, i; (I = 0; i & lt; lim-1 & amp; (C = getchar ())! = EOF & amp; c! = '\ N'; ++ i) S [i] = C; If (C == '\ n') {s [i] = c; ++ i; } S [i] = '\ 0'; Return i; } / * Copy: 'from' to 'per' from ';' Suppose that is large enough * / zero per (four to [], four to []) {int i; I = 0; While ((from [i] = to [i]) = '\ 0') ++ i; }  

Similar problem is encountered, if we run it in XP

GCC and G ++ are installed, as well as for Windows There are also Mingavs.

Can you please tell me what is the problem

Nothing comes when entering this code

This is the correct behavior of your code to push submit But nothing is designed to print.

That code, in particular, requires the end of the file signals. If your program reads from a file (as is the case with the idea), the last sign of the file is more or less automatically if your program reads from the computer keyboard (as you run it interactively) , Then you have to provide the end time of the file.

To use the code provided by you:

On Linux, enter several lines of length from the keyboard, enter after each . Then enter Control - D on a line with yourself.

On the keyboard, enter several lines of different lengths from the keyboard, after each enter . Then enter Control - Z on your own line.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -