6 תשובות
שואל השאלה:
רמה גבוה, רמה של סוף כיתה י' כאילו תשלח רמה גבוה מבחינתך מקסימום אגיד לך שזה גבוה מדי ותשלח יותר נמוך
רמה גבוה, רמה של סוף כיתה י' כאילו תשלח רמה גבוה מבחינתך מקסימום אגיד לך שזה גבוה מדי ותשלח יותר נמוך
שואל השאלה:
ישמצב לקבל את זה בתור מחלקות ולא בתוך הפרוגרם?
ישמצב לקבל את זה בתור מחלקות ולא בתוך הפרוגרם?
using system;
using system.collections.generic;
using system.text;
namespace kolboconsoleapplication
(
class program
(
static void main (string () args)
(
int () kbsales = ( ( 12, 0, 24, 22, 17),
( 59, 114, 5, 84, 21),
(120, 212, 175, 32, 72),
( 41, 28, 76, 114, 360),
( 80, 172, 69, 85, 34),
(107, 29, 64, 185, 105) );
typesales (kbsales);
/* כאן אמורה להיות קריאה לפונקציה המדפיסה מספר הקופאי הטוב ביותר */
bestcashier (kbsales);
console.writeline ("the worst unit is: (0)",worstunit (kbsales)
/* כאן תקרה הפונקציה המחזירה מספר המחלקה הגרועה ביותר */);
console.write ("\n\n\t");
)
/* כאן הגדר הפונקציה המדפיסה מספר הקופאי הטוב ביותר */
static void bestcashier (int () a)
(
int r, c, bestr=0, bestc=0, bestsale = -1;
for (r = 0; r < a.getlength (0); r++)
for (c = 0; c < a.getlength (1); c++)
if (a (r, c) > bestsale)
(
bestc = c+1;
bestr = r+1;
bestsale = a (r, c);
)
console.writeline ("the best cashier: (0) of the unit number (1)",bestc,bestr);
)
/* כאן הגדר הפונקציה הממזירה את מספר המחלקה הגרועה ביותר */
static int worstunit (int () a)
(
int c, r=0, sumunit = 0, worstsum, worstr = 0;
for (c = 0; c < a.getlength (1); c++)
(
sumunit += a (r, c);
)
worstsum = sumunit;
for (r = 1; r < a.getlength (0); r++)
(
sumunit = 0;
for (c = 0; c < a.getlength (1); c++)
(
sumunit += a (r, c);
)
if (sumunit < worstsum)
(
worstsum = sumunit;
worstr = r;
)
)
return worstr + 1;
)
static void typesales (int () kb)
(
console.writeline ("\tall kolbo sales:");
for (int un = 0; un < kb.getlength (0); un++)
(
console.write ("the unit number (0):\t (1)",
un + 1, kb (un, 0));
for (int cs = 1; cs < kb.getlength (1); cs++)
console.write (",\t (0)", kb (un,cs));
console.writeline ();
)
console.writeline ();
)
)
)
פה מקבלים מערך דו מימדי של טורים ושורות כל שורה מייצג קופה וכל טור מייצגת מספר קופאי
א. לומר איזה קוםאי מבין כולםם הכניס הכי הרבה
ב. איזה קופה (שורה) הכניסה הכי קצת
using system.collections.generic;
using system.text;
namespace kolboconsoleapplication
(
class program
(
static void main (string () args)
(
int () kbsales = ( ( 12, 0, 24, 22, 17),
( 59, 114, 5, 84, 21),
(120, 212, 175, 32, 72),
( 41, 28, 76, 114, 360),
( 80, 172, 69, 85, 34),
(107, 29, 64, 185, 105) );
typesales (kbsales);
/* כאן אמורה להיות קריאה לפונקציה המדפיסה מספר הקופאי הטוב ביותר */
bestcashier (kbsales);
console.writeline ("the worst unit is: (0)",worstunit (kbsales)
/* כאן תקרה הפונקציה המחזירה מספר המחלקה הגרועה ביותר */);
console.write ("\n\n\t");
)
/* כאן הגדר הפונקציה המדפיסה מספר הקופאי הטוב ביותר */
static void bestcashier (int () a)
(
int r, c, bestr=0, bestc=0, bestsale = -1;
for (r = 0; r < a.getlength (0); r++)
for (c = 0; c < a.getlength (1); c++)
if (a (r, c) > bestsale)
(
bestc = c+1;
bestr = r+1;
bestsale = a (r, c);
)
console.writeline ("the best cashier: (0) of the unit number (1)",bestc,bestr);
)
/* כאן הגדר הפונקציה הממזירה את מספר המחלקה הגרועה ביותר */
static int worstunit (int () a)
(
int c, r=0, sumunit = 0, worstsum, worstr = 0;
for (c = 0; c < a.getlength (1); c++)
(
sumunit += a (r, c);
)
worstsum = sumunit;
for (r = 1; r < a.getlength (0); r++)
(
sumunit = 0;
for (c = 0; c < a.getlength (1); c++)
(
sumunit += a (r, c);
)
if (sumunit < worstsum)
(
worstsum = sumunit;
worstr = r;
)
)
return worstr + 1;
)
static void typesales (int () kb)
(
console.writeline ("\tall kolbo sales:");
for (int un = 0; un < kb.getlength (0); un++)
(
console.write ("the unit number (0):\t (1)",
un + 1, kb (un, 0));
for (int cs = 1; cs < kb.getlength (1); cs++)
console.write (",\t (0)", kb (un,cs));
console.writeline ();
)
console.writeline ();
)
)
)
פה מקבלים מערך דו מימדי של טורים ושורות כל שורה מייצג קופה וכל טור מייצגת מספר קופאי
א. לומר איזה קוםאי מבין כולםם הכניס הכי הרבה
ב. איזה קופה (שורה) הכניסה הכי קצת
אממ זה לא יצא כמו שהתכוונתי... אני יכול לשלוח את הקוד בקובץ וורד כי פה זה לא יוצא טוב
אני אשלח בכל זאת מה שיש לי
using system;
using system.collections.generic;
using system.text;
namespace ismatrixsorted
(
class program
(
static void main (string () args)
(
int () mat1 = ( (12, 25, 34, 38),
(40, 44, 59, 61),
(68, 73, 84, 86));
int () mat2 = ( (12, 25, 34, 38),
(40, 44, 59, 16),
(68, 73, 84, 86));
console.writeline ("\n\tfirst matrix is:\n");
typearray (mat1);
console.writeline ("\nis this matrix sorted?: (0)",matrixsort (mat1)
/* call your function with parameter mat1 */);
console.writeline ("\n\tsecond matrix is:\n");
typearray (mat2);
console.writeline ("\nis this matrix sorted?: (0)", matrixsort (mat2)
/* call your function with parameter mat2 */);
console.write ("\n\n\t");
)
// input your function definition
static bool matrixsort (int () matrix)
(
bool issort = true;
int r, c, lastc = 0,lastr = 0;
for (r = 0; r < matrix.getlength (0) && issort; r++)
(
for (c = 0; c < matrix.getlength (1) && issort; c++)
(
if (matrix (r, c) < matrix (lastr, lastc))
(
issort = false;
)
else
(
lastc = c;
lastr = r;
)
)
)
return issort;
)
static void typearray (int () a)
(
for (int i = 0; i < a.getlength (0); i++)
(
console.write (a (i, 0));
for (int j = 1; j < a.getlength (1); j++)
console.write (" (0,3)", a (i, j));
console.writeline ();
)
)
)
)
פה מקבלים שני מערכים וצריכים לבדוק האם הם ממוינים בסדר עולה (משתמשים פה גם בפונקציות)
using system;
using system.collections.generic;
using system.text;
namespace ismatrixsorted
(
class program
(
static void main (string () args)
(
int () mat1 = ( (12, 25, 34, 38),
(40, 44, 59, 61),
(68, 73, 84, 86));
int () mat2 = ( (12, 25, 34, 38),
(40, 44, 59, 16),
(68, 73, 84, 86));
console.writeline ("\n\tfirst matrix is:\n");
typearray (mat1);
console.writeline ("\nis this matrix sorted?: (0)",matrixsort (mat1)
/* call your function with parameter mat1 */);
console.writeline ("\n\tsecond matrix is:\n");
typearray (mat2);
console.writeline ("\nis this matrix sorted?: (0)", matrixsort (mat2)
/* call your function with parameter mat2 */);
console.write ("\n\n\t");
)
// input your function definition
static bool matrixsort (int () matrix)
(
bool issort = true;
int r, c, lastc = 0,lastr = 0;
for (r = 0; r < matrix.getlength (0) && issort; r++)
(
for (c = 0; c < matrix.getlength (1) && issort; c++)
(
if (matrix (r, c) < matrix (lastr, lastc))
(
issort = false;
)
else
(
lastc = c;
lastr = r;
)
)
)
return issort;
)
static void typearray (int () a)
(
for (int i = 0; i < a.getlength (0); i++)
(
console.write (a (i, 0));
for (int j = 1; j < a.getlength (1); j++)
console.write (" (0,3)", a (i, j));
console.writeline ();
)
)
)
)
פה מקבלים שני מערכים וצריכים לבדוק האם הם ממוינים בסדר עולה (משתמשים פה גם בפונקציות)
תגדירי ברמה גבוהה כי יש לי כל מיני שאלות ותשובות
באותו הנושא: