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();
}

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;
}

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

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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.