function not running
it runs fine up until p.bubbleSort i think, im not sure how to call my function properly im just trying to use the sort to sort the array
13 Replies
What's
p
?
Your bubbleSort()
takes an array of integers
You call it on some p
object without giving it any datayeah this code won't even compile, let alone run
you'd call your function like
bubbleSort(array);
, because it's not a member of p
(p doesn't exist at all?) you can't do p.bubbleSort();
there is a way to use that syntax called extension methods, but that's not what you have herei just removed the p and it worked
but im trying to output an integer
at the start of the write line
and its saying it cant be parsed or smth
This will not compile
yh ik
its not
idk what im doing wrong
Console.WriteLine()
with more than one parameters expects the first one to be a template string
And the rest to be data to insert into the template
Use $interpolationString interpolation is the preferred way of building strings in C#. It is easier to read than concatenation.
For example:
can be written as:
it was working fine till i added the int parse count 3 bit
Well, you added it outside of the string
Where the template string goes
So
"I hit my TV with a hammer to switch the channel and it no longer works" vibes
either a) it did not work or b) you did more than just remove the p
please be specific instead of saying "not work," there are a lot of possible problems from compile time errors (your program will not build and you have red squiggles) to run time errors (the program doesn't do what you want or it crashes)
this line is running in a loop
but each loop it isnt outputting to a new line
its just adding to the end
how do i go onto a new line
after every iteration
Add a newline character, for example
\n
Or see if maybe there is File.AppendLine()
methodthx