need help in starting C++ project

need help in getting my project started

Page 1 of 1

6 Replies - 1373 Views - Last Post: 28 April 2008 - 01:00 PM Rate Topic: -----

#1 cooter1341  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-April 08

need help in starting C++ project

Posted 23 April 2008 - 07:05 PM

I am having trouble in getting my project off the ground. I have completed a bunch of individual tasks in the past, just not one that has multiple items or functions in one big project. So for the most part I am really stumped in how to actually start the project and which item goes first, then second, and so on. Then to tie it all in to work together is another big issue. Any guidence I could be given would be great.

Here is what my project entails. Thank you in advance!

A, working C++ program that utilizes a good design process and incorporates sequential, selection and repetitive programming statements as well as at least one function call. You should design, create, and then compile and execute the program. Be sure that your code compiles and executes correctly.

Project Objective:
Use the process of stepwise refinement to construct programs
Demonstrate and explain the execution of sequential, conditional, and iterative programming statements
Create and use functions
Create, compile, and execute simple programs written in a modern object-oriented language
Critically analyze project design solutions

Is This A Good Question/Topic? 0
  • +

Replies To: need help in starting C++ project

#2 Guest_Whizzy*


Reputation:

Re: need help in starting C++ project

Posted 24 April 2008 - 05:18 AM

View Postcooter1341, on 23 Apr, 2008 - 07:05 PM, said:

I am having trouble in getting my project off the ground. I have completed a bunch of individual tasks in the past, just not one that has multiple items or functions in one big project. So for the most part I am really stumped in how to actually start the project and which item goes first, then second, and so on. Then to tie it all in to work together is another big issue. Any guidence I could be given would be great.


I know you're going to think me a smart tail, but in all seriousness, these guys aren't going to sit here, and design your homework for you. Then help you program it. You already know what you need to do, you have the instructions... Sit down with a good old fashion paper and a pencil, or even a word processor, put "Start" at the top of your page, and put "End" at the bottom. List your objectives in between and give your self a little bit of space... in those spaces, break down your tasks smaller and smaller until you do know how to program it, or you are completly stumped. Give these guys a little bit of code to work with.

Write as much code as you know how, to achieve these objectives. You'll find here, you get exactly what you give. When you have done your best, these fine gents will give you their best. If you give them nothing... well...
So, make an effort at a design, (even if it is way off base), and post that. That will show some type of effort on your behalf, and these gents will work with you.

This post has been edited by Whizzy: 24 April 2008 - 05:30 AM

Was This Post Helpful? 0

#3 cooter1341  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-April 08

Re: need help in starting C++ project

Posted 24 April 2008 - 03:39 PM

Thank you for your input, I am new to this site and wasn't exactly sure how it worked. By the way, I wasn't looking for a hand out and for someone to do all my work for me, just wanted some basic input on how to actually get going, since I have never compiled multiple items at once. In the past its always been just one task at a time. No big deal, I will take your advice and run with it. I will put it all down and go from there, so thank you for that, in a way you did get me started with it, and thats what I needed.
Was This Post Helpful? 0
  • +
  • -

#4 cooter1341  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-April 08

Re: need help in starting C++ project

Posted 27 April 2008 - 02:35 PM

Here is what I have so far, can't seam to get this Array to work. Any ideas? Thanks

#include <iostream>
using namespace std;
 
const int SIZE = 10;
 
int max(int a[]);
 
int main()
{
	int arrayone[SIZE];
	
	int max_value;
 
	for(int i=0; i<SIZE; i++)
	arrayone[i] = i+1;
	
	max_value = x;
 
	cout <<"The maximum element of the array is "<< max_value <<endl;
	return(0);
}
 
int max(int a[])
{
	int maximum;
	for (int i=x; i<x; i++)
	{
		if (maximum < a[i])
			maximum = a[i];
	}	
	return(maximum);
}



Was This Post Helpful? 0
  • +
  • -

#5 Guest_Whizzy*


Reputation:

Re: need help in starting C++ project

Posted 27 April 2008 - 02:44 PM

View Postcooter1341, on 27 Apr, 2008 - 02:35 PM, said:

Here is what I have so far, can't seam to get this Array to work. Any ideas? Thanks



You have a variable "X" that was not initilized.

Note: You are using X in the main, and in a function. Are you wanting this to be a global variable ?

This post has been edited by Whizzy: 27 April 2008 - 02:51 PM

Was This Post Helpful? 0

#6 cooter1341  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-April 08

Re: need help in starting C++ project

Posted 27 April 2008 - 07:50 PM

Hey, sorry I didn't respond to you sooner, but I decided to go a different route with the Array code. I needed to input numbers (at leat 10) and then come up with the average. My code isn't pretty but it does compile and run. Also, it only shows whole numbers and not the percentages. Like for the average it only will only show a 4, instead of a 4.5. Not to big of a deal, I was just happy that I was able to figure it out and actually make it compile.

Well, let me know what you think and where improvement could happen. Thanks.


#include <stdio.h>
#include <conio.h>

#include <iostream>
using namespace std;

#define   SIZE  12
int main()

{
int b, c, d, e, f, g, h, j, k, l, m, p; 
cout << "We will enter 12 positive numbers : ";

cout << "Enter the first positive number : ";
	cin >> b;
cout << "Enter the second positive number : ";
	cin >> c;
cout << "Enter the third positive number : ";
	cin >> d;
cout << "Enter the fourth positive number : ";
	cin >> e;
cout << "Enter the fifth positive number : ";
	cin >> f;
cout << "Enter the sixth positive number : ";
	cin >> g;
cout << "Enter the seventh positive number : ";
	cin >> h;
cout << "Enter the eighth positive number : ";
	cin >> j;
cout << "Enter the ninth positive number : ";
	cin >> k;
cout << "Enter the tenth positive number : ";
	cin >> l;
cout << "Enter the eleventh positive number : ";
	cin >> m;
cout << "Enter the twelvth positive number : ";
	cin >> p;

	   // declare and initialize the array named a with size SIZE
	   int a[SIZE] = {b, c, d, e, f, g, h, j, k, l, m, p};
	   // declare two normal variables
	   int i, average, total = 0;
	   // do the loop for the array...
	   for(i = 0; i <= (SIZE-1); i++)
	   {
			  // display the array and its element...
			  printf("\n a[%d]= %d", i, a[i]);
			  // total up the array
			  // total = total + a[i]
			  total += a[i];
			
	   }
	   printf("\nThe sum of the array elements is %d\n", total);
	   { 
		   average = total/12;

	   }
	 printf("\nThe average of the array elements is %d\n", average);
	   return  0;
}


Was This Post Helpful? 0
  • +
  • -

#7 gabehabe  Icon User is offline

  • GabehabeSwamp
  • member icon




Reputation: 1385
  • View blog
  • Posts: 10,962
  • Joined: 06-February 08

Re: need help in starting C++ project

Posted 28 April 2008 - 01:00 PM

You could use a float for the average to represent it as a decimal value.

I have a suggestion for your code: You ask the user to input positive numbers every time, right? How about some kind of check to make sure it is a positive number, like this:
cout << "Enter the first positive number : ";
cin >> b;
while (b < 0) // checks if it is below 0
{
    cout << "I asked for a positive number, and you gave a negative one\n"
           << "Enter the first positive number (again): ";
    cin >> b; // gets b until it is made positive
}

Hope this helps :)

This post has been edited by gabehabe: 28 April 2008 - 01:08 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1