0
#include<stdio.h>
#include<conio.h>
int main()
{
 char cyp[150],eng[26];
 scanf("%s",eng);
 gets(cyp);
 getch();
 return 0;
}

eng is accepted but only one letter is accepted for cyp.

6
Contributors
10
Replies
42
Views
3 Years
Discussion Span
Last Post by rory.starkweather.7
Featured Replies
  • what did you enter for cyp? gets() doesn't accept spaces. You should NEVER EVER use gets() because it can corrupt your program's memory when you enter more characters than the buffer can hold. Instead, use fgets(), such as `fgets(cyp,sizeof(cyp),stdin);` scanf() with "%s" has a similar problem, you can use "%149s" … Read More

  • >Your indent style is needing big improvement. I'd hate to see his 1,000 line long program :) Read More

  • Yes you're right. My first few attempts I couldn't even get a Hello World program to work! Read More

  • First, highlight the text you want to quote and press Ctrl+C (copy to clipboard) Next, in your post where you want the text to appear first insert > character then press Ctrl+V (paste from clipboard) [Here](https://www.google.com/#q=c%2B%2B+style+guide) are some links where you can find good coding style guides. There is no … Read More

  • 1

    > how can I quote a respose? There a question mark button on the editor that will take you to [this page](http://www.daniweb.com/community/syntax) describing our Markdown formatting. You can also use any of the other buttons for quick formatting without manually typing it yourself. Just clicking the button will give you … Read More

1

what did you enter for cyp? gets() doesn't accept spaces.

You should NEVER EVER use gets() because it can corrupt your program's memory when you enter more characters than the buffer can hold. Instead, use fgets(), such as fgets(cyp,sizeof(cyp),stdin); scanf() with "%s" has a similar problem, you can use "%149s" to limit input to 149 characters plus 1 for null terminator.

0
 With reference to ur query,
 #include<stdio.h>
     #include<conio.h>
         int main()
             {
                 char eng[26];
                 clrscr();
                     //scanf("%s",&eng);
                         gets(eng);
                         puts(eng);
                             getch();
                                 return 0;
  }
0

@naveen1993

Please note:

  1. old post (now dead? - maybe you missed the date?)

  2. NOT portable code ...
    if one uses <conio.h> , clrscr, getch, etc...

  3. maybe you missed the CLEAR warning of @Ancient Dragon
    about NOT using gets!!!

    Please Google ... "C why DO NOT use gets"

  4. Your indent style is needing big improvement.

0

Hey ... we all needed to start, somewhere ... and if some code compiles ... and IF it also gives the 'correct' output ... and if one is just beginning ... that can feel like it IS such a big success ... at first ...

I recall that it DID take me a long time before I wasn't terrorized by compiler errors and warnings ... and actually learned to 'like them' ... as I began to 'see' how they prompted me to fix the typos and other coding errors.

Edited by David W

0

Hey, AD, how can I quote a respose? Or is that something I don't have access to?

As to your comment about 1000 line code modules, I have to admit that my stuff is non-standards, but I do try to keep it all in view.

1

First, highlight the text you want to quote and press Ctrl+C (copy to clipboard)

Next, in your post where you want the text to appear first insert > character then press Ctrl+V (paste from clipboard)

Here are some links where you can find good coding style guides. There is no one-way to code so select what you find useful to you.

Edited by Ancient Dragon

1

how can I quote a respose?

There a question mark button on the editor that will take you to this page describing our Markdown formatting. You can also use any of the other buttons for quick formatting without manually typing it yourself. Just clicking the button will give you a default output, and clicking the button with text already highlighted will format it for you.

This article 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.