so i am on my last 2 programs for my programminng course and i only have till monday(3 days) to do both of them
here are the guidlines for the first project:
14-1
Write a program that declares an array of ten floating point values. Have the program
prompt the user for each of the ten floating point values and store them
into the anay. The program should then report how many of the values entered
are larger than the value in the first element of the array. For example, if the
values entered are 5.2, 6.1, 2.9, 3.8, 8.9, 3.3, 2.0, 9.7, 7.4, 7.3, and 5.5, the program
should report that 5 of the values in the array are larger than the value in the first
element.
14-2
and here are the guidelines for the second:
Write a program that is functionally identical to the program described in project
14-1. In this version, however, use the vector class instead of a standard C++
array
so here is the code that ive done so far and i have got this far then i got stumped so i dont really know what to do, could anybody help guide me through how to finish this project help woul; dbe greatly apreciated.( please just pseaudo code, i need to understand it)

#include <iostream>
#include <iomanip>
using namespace std;
float x[11];
int main()
{
    cout <<"enter ten numbers that are to be stored in the array";
    cout <<"this program will then tell you how many integers are"; 
    cout <<"larger then the first integer entered" <<endl;
    Sleep (1500);


    int index;
for ( index = 1; index <= num_values; index++)
{
    cout <<enter your number





    return 0;
}

ok kinda forgot my code so far

line 4: the array should have 10 values, not 11.

line 14: array indix values are 0 based, meaning 0, 1, 2, ... 9. There is no 10th. Count them on your fingers if you have to so that you verify to yourself that 0 to 9 is 10 values.

Also, variable num_values is not declared.

line 16: you have to put quotes around the text that you want displayed.

line 17: you need cin << array[i]; to get keyboard input

sorry for the roughness of the code i was in the middle of working on it when i posted it so lot of my coding grammar was missing, thansk though

Also, going by your guildlines, your ints need to be floats.

ok so i fixed most of my problems and i got my loop/ array to partially work. the porgram allows you to imput numbers bu i still need to make a function or something that will take all the numbers and find out how many have a value greater then the value of the first unmber entered. coulds somebody help me out with this one?

here is my code

#include <iostream>
#include <iomanip>
#include <Windows.h>
using namespace std;
float x[10];
int i;
int array;
int integer;
int main()
{
    cout <<"enter ten numbers that are to be stored in the penis array";
    cout <<"this program will then tell you how many integers are"; 
    cout <<"larger then the first integer entered" <<endl;
    Sleep (1500);


    int index;
    for ( index = 9; index >= 0; index--)

    {
        cout << "enter an integer " <<endl;
        cin >> integer;
    }


    return 0;
} 

It takes more than that to provide any shock value. Nice try though. Hope you had fun.

????
what do you mean by that?

line 11 contains a word that is seldom seen in programming and has no role in your program other than shock value.

ok thanks for that i guess my brother should learn to mind his own buisness and stay out of my codeing stuff.

would you by anychance be able to help me with my problem?

You need a for loop to loop through your array and everytime it doesn, check to see if the current array value is larger then the array value 0.

Try to code that, then post back on where you get stuck.

Why start at the end of the array and fill it in towards the front. Can be done, no prob, other than being a little unconventional.

Try to write code that displays 2 elements of the array. Post that code if it this post doesn't contain enough of a clue what to do.

What operators are used to compare variables?

You need to be a little careful when comparing floating point numbers, but that isn't the crux of your problem at this point.

ok so any part of the code with a comment is a either something im not sure about or something that think should be done diffenrently

#include <iostream>
#include <iomanip>
#include <Windows.h>
using namespace std;
float x[10];
int i;
int first_integer
int array;
int integer;
int main()
{
    cout <<"enter ten numbers that are to be stored in the array";
    cout <<"this program will then tell you how many integers are"; 
    cout <<"larger then the first integer entered" <<endl;
    Sleep (1000);

    cout <<"enter the first integer" <<endl;
    cin >> first_integer;

    int
{   
    if (first_integer >= integer)
        //need someway to store(the vlaue) if the integer is greater then the first integer
        //for later use at the end of the program

        //would it no be esier for the program to go voer all of the numbers at the end of the program and nut during the loop?


    int index;
    for ( index = 8; index >= 0; index--)

    {
        cout << "enter an integer " <<endl;
        cin >> integer;
    }

}
    // is there w ay that i could get the program to display all numbers at the bottom that have ahigher value then the first integer?
    return 0;
} 
const int MAX = 10
int A [MAX]
int higherInts[MAX]
int numElement = 0

for (int i = 0; i < MAX; ++i)
  input MAX ints into A

use another loop ranging from 1 to MAX - 1
  if first element of A lesss than current element of A
    store current element of A at index equal to numElement in higherInts
    adjust value numElement appropriately

Number of elements in higherInts are all greater than first element of A

so lerner i realze you are trying to help me but the whole point of the project is to use an array, and so far i dont think ive really used one.

The pseudocode uses one loop to enter the values into an array and another to test whether elements in the array are larger than the first element, or not. If the current element is larger than the first one then the current element is store in another array, the index of which is the number of elements actually in the array. You can use the second array later if you want to. For example you can use it to print out all the elements in the second array if you want to. You could of course print out each value greater than the one in with index 0 in the first array as you find it and just use the counter as a counter instead of using the counter as an index for the second array, but it looks like you could use the practice using arrays, so why not take advantage of a classic situation where arrays are used?

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.