עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ביטול רווחים בין שורות C++

Featured Replies

פורסם

בניתי תוכנית למשחק 7 BOOM.

בכל פעם כשיש מספר BOOM רצופים יש בניהם מרווח:

BOOM

BOOM

וכדומה..איך אני מבטלת את המרווח הזה???

תודה!(:


#include <stdio.h>
#include <conio.h>
#include <math.h>

int main(){
int n,j,w;
printf("insert a number within [1,1100]:");
scanf_s("%d",&n);
if(n==0){
printf("good bye!!");
_getch();
return(0);}

while(n)
{
if(0>n||n>1110)printf("illegal number,please insert a number within [1,1100]:");

else
{
w=(1>n-5)?1:n-5;
for(j=w;j<=n+10;j++)
{
if(j==7||j%10 == 7 || (j/10)%10 == 7 || (j/100)%10==7)
{
printf("boom\n");
}
else {

printf("%d ",j);

}

}
}
printf("\n");
printf("insert numbers [1, 1100]:");
scanf("%d",&n);
}
}



פורסם

בניתי תוכנית למשחק 7 BOOM.

בכל פעם כשיש מספר BOOM רצופים יש בניהם מרווח:

BOOM

BOOM

וכדומה..איך אני מבטלת את המרווח הזה???

תודה!(:


#include <stdio.h>
#include <conio.h>
#include <math.h>

int main(){
int n,j,w;
printf("insert a number within [1,1100]:");
scanf_s("%d",&n);
if(n==0){
printf("good bye!!");
_getch();
return(0);}

while(n)
{
if(0>n||n>1110)printf("illegal number,please insert a number within [1,1100]:");

else
{
w=(1>n-5)?1:n-5;
for(j=w;j<=n+10;j++)
{
if(j==7||j%10 == 7 || (j/10)%10 == 7 || (j/100)%10==7)
{
printf("boom\n");
}
else {

printf("%d ",j);

}

}
}
printf("\n");
printf("insert numbers [1, 1100]:");
scanf("%d",&n);
}
}



יש לך בסוף הקוד ירידת שורה

פורסם

איזה קוד מבולגן...

תעשה טובה ותסדר אותו ואת האינדנטציה.

פורסם
  • מחבר

איזו שורה?

סורי אני לא רואה את הקו התחתון

נקודה חשובה ששכחתי

הפלט אמור להראות ככה לדוגמא:

692

boom

694 695 696

boom

698 699

boom

boom

boom

וכו

פורסם

איזה קוד מבולגן...

תעשה טובה ותסדר אותו ואת האינדנטציה.

ובנוסף, חפש מדריכים קצת יותר עדכניים. conio.h כבר לא בשימוש מזמן.

פורסם

יש לך יותר מידי ירידת שורה

לדעתי ה/n בשורה 35 מיותר

פורסם
  • מחבר

ביטלתי את הn\ בשורה 35 והרווחים באמת התבטלו

אבל כל שאר הפלט משתנה עכשיו

פורסם



#include <stdio.h>
#include <conio.h>
#include <math.h>


int main(){
int n,j,w;
printf("insert a number within [1,1100]:");
scanf("%d",&n);
if(n==0){
printf("\ngood bye!!");
_getch();
return(0);}


while(n)
{
if(0>n||n>1110)printf("\nillegal number,please insert a number within [1,1100]:");

else
{
w=(1>n-5)?1:n-5;
for(j=w;j<=n+10;j++)
{
if(j==7||j%10 == 7 || (j/10)%10 == 7 || (j/100)%10==7)
{
printf("boom\n");
}
else {


printf("%d ",j);

}

}
}


printf("\ninsert numbers [1, 1100]:");
scanf("%d",&n);
}
}


??

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.