Language c - Software - HWzone Forums
adplus-dvertising
Skip to content
  • Create an account
  • About Us

    Hello Guest!

     
    Please note - in order to participate in our community, comment and open new discussions, you must join as a registered member.

    Our members enjoy many advantages, including the ability to participate in discussions, enjoy raffles and promotions for members of the site, and receive our weekly content directly by email.

    Do not like being harassed by email? You can register for the site but do not submit your registration to the weekly email updates.

The language c


Alon Edelstein
 Share

Recommended Posts

Hi we were asked to find a plinth in c. When we need to receive from the user the following numbers: 

s will be the number that the user enters (type int) whose length we do not know.

In addition, the number k will be entered to determine the length of the first plinth in the number s.

For example: if the number s = 13455431 is entered from the user

And enter k = 2 then the plinth will be 55.

For k = 3 the plinth will be: does not exist

For k = 1 the plinth will be 1.

For k = 4 the plinth will be 4554.

I'd love to help sitting on it for hours and don't know how to start even 

Link to content
Share on other sites

Attaches a partial solution

Note to do an input health check

If you give an odd-sized cycle also K should make an odd

If S is even in length then K should also be even

Successfully

 

 

#include #include void main (void) {char s [255] = "0"; char output [255] = "0"; int k, i, k_part2, j = 0; printf ("hi world ... \ nPlease enter string-"); #pragma warning (suppress: 4996) scanf ("% s", & s); printf ("\ nPlease enter value for k-"); #pragma warning (suppress: 4996) scanf ("% d", & k); k_part2 = k; if (k == 1) printf ("\ n% c", s [0]); else {int x = strlen (s) / 2; int iszogi = strlen (s)% 2; if (iszogi! = 0) {output [k_part2 / 2 + 1] = s [x]; for (i = 1; i <= k; i ++) {if (s [x - i] == s [x + i]) {} else break; } for (i = (x) -k / 2; i <= (x) + k / 2; i ++) {printf ("% c", s [i]); }} else {for (i = 0; i <= k; i ++) {if (s [x - i] == s [x + i]) {} else break; } for (i = (x) -k / 2 + 1-1; i <(x) + k / 2; i ++) {printf ("% c", s [i]); }}}}

 

Link to content
Share on other sites

Quote by Alon Edelstein

Hi we were asked to find a plinth in c. When we need to receive from the user the following numbers: 

s will be the number that the user enters (type int) whose length we do not know.

In addition, the number k will be entered to determine the length of the first plinth in the number s.

For example: if the number s = 13455431 is entered from the user

And enter k = 2 then the plinth will be 55.

For k = 3 the plinth will be: does not exist

For k = 1 the plinth will be 1.

For k = 4 the plinth will be 4554.

I'd love to help sitting on it for hours and don't know how to start even 

There's a programming forum, it's a software forum. Ask the principals to move.

Sure C or maybe C ++? If you do not know - did you use cout or printf?

Quote of Outlook

 


#include #include void main (void) {char s [255] = "0"; char output [255] = "0"; int k, i, k_part2, j = 0; printf ("hi world ... \ nPlease enter string-"); #pragma warning (suppress: 4996) scanf ("% s", & s); printf ("\ nPlease enter value for k-"); #pragma warning (suppress: 4996) scanf ("% d", & k); k_part2 = k; if (k == 1) printf ("\ n% c", s [0]); else {int x = strlen (s) / 2; int iszogi = strlen (s)% 2; if (iszogi! = 0) {output [k_part2 / 2 + 1] = s [x]; for (i = 1; i <= k; i ++) {if (s [x - i] == s [x + i]) {} else break; } for (i = (x) -k / 2; i <= (x) + k / 2; i ++) {printf ("% c", s [i]); }} else {for (i = 0; i <= k; i ++) {if (s [x - i] == s [x + i]) {} else break; } for (i = (x) -k / 2 + 1-1; i <(x) + k / 2; i ++) {printf ("% c", s [i]); }}}}

 

seriously? iszogi? Are names changing in Hebrew? disable warnings? And besides he said to receive for int and not string. Magic numbers. Line drop after scanf. No buffer cleaning. if empty and after else. There is no code style uniformity. Code duplication. Incorrect operator priority (no brackets when needed). And after all that, the code is not at all What is required.

I have not seen such a code in a long time.

Link to content
Share on other sites

Quote by af db creid

There's a programming forum, it's a software forum. Ask the principals to move.

Sure C or maybe C ++? If you do not know - did you use cout or printf?

seriously? iszogi? Are names changing in Hebrew? disable warnings? And besides he said to receive for int and not string. Magic numbers. Line drop after scanf. No buffer cleaning. if empty and after else. There is no code style uniformity. Code duplication. Incorrect operator priority (no brackets when needed). And after all that, the code is not at all operation What is required.

I have not seen such a code in a long time.

Glad to challenge you keyboard troll

I'm trying to help someone and get ricochets from you? 

Write your amazing code and refer it to the writer

I did not ask or ask your opinion

 

Link to content
Share on other sites

Join the discussion

You can then join the discussion and then join our community. If you already have an account with us, please Log in now To comment under your username.
Note that: The comment will appear to the surfers after approval by the board management team.

guest
Add a comment

×   The content pasted is with formatting.   Remove formatting

  Only 75 emoji are allowed.

×   Your link has been automatically assimilated.   Show as regular link

×   Your previous content has been automatically restored.   Clear all

×   You can not paste images directly. Upload or insert images from URL.

 Share

  • Latest news

  • Buzz-Zone: Everything hot on the net

  • Popular now

×
  • Create new ...

At the top of the news:

new on the site