write c++ statements to accomplish each of the following:
1) Display the value of element 6 of character array f.
2) Input a value into element 4 of one-dimensional floating-point array b.
3) Initialize each of the 5 elements of one-dimensional integer array g to 8.
4) Total and print the elements of floating-point array c of 100 elements.
1) cout<<f[5]<<endl; or cout<<f[6]<<endl;
is this correct. if yes, then what is character all about? do i have to include it somewhere
2) cin>>b[4] or cin<<b[3]; (confused btn position index and element)
is this correct? i do not get the floating part bit.
3) int g[5]={8,8,8,8,8}
4) (int i=0;i<100,i++)
total+=c[i]
cout<<"Total : "<<total;
is it correct? what do they mean by floating point array c?
thank you.
c++ statements
Started by kumamako, Jul 18 2009 11:53 PM
5 replies to this topic
#1
Posted 18 July 2009 - 11:53 PM
|
|
|
#2
Posted 19 July 2009 - 05:30 AM
kumamako said:
write c++ statements to accomplish each of the following:
1) Display the value of element 6 of character array f.
2) Input a value into element 4 of one-dimensional floating-point array b.
3) Initialize each of the 5 elements of one-dimensional integer array g to 8.
4) Total and print the elements of floating-point array c of 100 elements.
1) cout<<f[5]<<endl; or cout<<f[6]<<endl;
is this correct. if yes, then what is character all about? do i have to include it somewhere
1) Display the value of element 6 of character array f.
2) Input a value into element 4 of one-dimensional floating-point array b.
3) Initialize each of the 5 elements of one-dimensional integer array g to 8.
4) Total and print the elements of floating-point array c of 100 elements.
1) cout<<f[5]<<endl; or cout<<f[6]<<endl;
is this correct. if yes, then what is character all about? do i have to include it somewhere
The declaration of f would have been:
char f[6];
kumamako said:
2) cin>>b[4] or cin<<b[3]; (confused btn position index and element)
is this correct? i do not get the floating part bit.
is this correct? i do not get the floating part bit.
b would have been declared as:
float b[4];
kumamako said:
3) int g[5]={8,8,8,8,8}
kumamako said:
4) (int i=0;i<100,i++)
total+=c[i]
cout<<"Total : "<<total;
is it correct? what do they mean by floating point array c?
thank you.
total+=c[i]
cout<<"Total : "<<total;
is it correct? what do they mean by floating point array c?
thank you.
c would have been declared:
float c[100];
#3
Posted 19 July 2009 - 11:54 PM
THANKS ALOT BRO! I really appreciate it man.
#4
Posted 21 July 2009 - 09:48 PM
1) Copy array a into the first portion of array b. Assume double a[ 11 ], b[ 34 ];
2)Determine and print the smallest and largest values contained in 99-element floating point array w.
2)Determine and print the smallest and largest values contained in 99-element floating point array w.
#5
Posted 22 July 2009 - 06:00 AM
It is starting to seem like you are asking people to do trivial things for you.
1. Use a loop
2. Use a loop and a comparison with a variable.
1. Use a loop
2. Use a loop and a comparison with a variable.
#6
Posted 22 July 2009 - 06:16 AM
We don't do homework. You have to at least offer an idea before we'll do much.


Sign In
Create Account


Back to top









