0

Question : Please Copy array A into 1st portion of array F .assume float a[11], f[34];

im using compiler Borland 5.02,

please tell me hows so far my code is correct?

#include<iostream>
#include<conio>
main()
{
float a[11],f[34];

int i;

for (i=0;i<11;i++)
      {
        cin>>a[i];
                   }

for (i=0;i<11;i++)
     {
      f[i]=a[i];
                  }

getch();
}

Edited by AmerJamil: n/a

4
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by 3bdelhakeem
0

There are many ways to do this..
Why do you ask if your solution is correct? You can check it for yourself by printing the first 11 values of f, to see if they match a.

Your declaration of 'main' is bad.. I hope the teacher did not show you to do it that way. It will still work though, but it makes more sense to write

int main() {

    return 0;
}
0

Your code is not formatted. Delete line 6.
Write conio.h innstead of conio.

Edited by alexchen: n/a

1

I'm sorry to tell you that your code is ugly :D

1. Your declaration of 'main' is bad, as thelamb said.
2. You put extra lines in your code.
3. The indentation of the code is unformatted, making it hard to read and ugly.
4. getch is not good to pause your program with, Read this.

I hope this helped. And by the way, try not to ask about the correctness of the code before you try it and see if it works correctly or not.

Cheers :)

Edited by 3bdelhakeem: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.