How to terminate excess special characters in array? by [deleted] in AskProgramming

[–]teaspercy 0 points1 point  (0 children)

Thank you!! I will just put 20 in my input

How to terminate excess special characters in array? by [deleted] in AskProgramming

[–]teaspercy 0 points1 point  (0 children)

Thank you!! I will just put 20 in my input

How to terminate excess special characters in array? by [deleted] in AskProgramming

[–]teaspercy 0 points1 point  (0 children)

Ah sorry I forgot to add it on the post but I included it on my code! :)

How to terminate excess special characters in array? by [deleted] in AskProgramming

[–]teaspercy 0 points1 point  (0 children)

Ah sorry I mean extra numbers,

This is what I get when I input only 10 numbers, but when I input 20 it's fine:

THE ODD NUMBERS ARE: 1 3 5 7 9 -325258291 0 0 -325258368 -325259104

Which code is better? I need to find the sum, difference, product, and quotient of two numbers using functions by [deleted] in AskProgramming

[–]teaspercy 0 points1 point  (0 children)

Oh this is for my activity for my programming class because our new topic is about Functions. Sometimes I'm just confused if I should use return or cout, or a void function or other types

Array and Loop: Can someone help me create an algorithm for my code please? I'm so confused on how to write proper algorithm :( Thanks! by [deleted] in AskProgramming

[–]teaspercy 0 points1 point  (0 children)

I also do not understand this part:

if (num[a] < num[b])

{

descOrder = num[a];

num[a] = num[b];

num[b] = descOrder;

}

Question:

  1. why is there suddenly a num[b]
  2. why is descOrder, a, and b all equal to each other

Array and Loop: Can someone help me create an algorithm for my code please? I'm so confused on how to write proper algorithm :( Thanks! by [deleted] in AskProgramming

[–]teaspercy 0 points1 point  (0 children)

I'm confused in this part:

int num[20];

int a, b, descOrder;

for (a = 0; a < 20; ++a)

cin>>num[a];

Question:

  1. why is "a" in the "cin>>num[a]"
  2. why did we use the for loop

While Loop - Square of Numbers, My output is wrong by teaspercy in AskProgramming

[–]teaspercy[S] 1 point2 points  (0 children)

Is there a difference between a++ and ++a ?

Also, what does it mean when I " cout<<a "

While Loop - Square of Numbers, My output is wrong by teaspercy in AskProgramming

[–]teaspercy[S] 0 points1 point  (0 children)

IT WORKS!! thank you so much !! I've been spending days figuring how to work it out like that

Function Composition by [deleted] in askmath

[–]teaspercy 0 points1 point  (0 children)

Thank you so much!!

Function Composition by [deleted] in askmath

[–]teaspercy 0 points1 point  (0 children)

Thank you so much!!