7 Replies - 9393 Views - Last Post: 28 January 2010 - 11:46 AM Rate Topic: -----

#1 patelkarn  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 28-January 10

C++ to raptor flowchart

Posted 28 January 2010 - 10:49 AM

OK so I have this code and I want to use raptor flowchart to do the same thing so if someone can help me I will be glad. I try doing it in raptor and don't know how to store the numbers in memory my raptor file is attached so please have a look.

#include <iostream>
using namespace std;

int main()
{
	cout << "Enter how many values you want to add: ";
	int items;
	cin >> items;
	double num;
	double sum;
	sum = 0.0;
	for (int x = 1; x <= items; x++)
	{
		cout << "#" << x << " = ";
		cin >> num;
		sum += num;		
	}
	cout << "Items = " << items << "\nSum = " << sum << "\nAverage = " << sum / items << "\n";
	return 0;



And I made a little program in raptor flowchart by myself its attached so please look at it


ohh its not allowing me to upload .rap file so i print screen it to the Microsoft word pad

Attached File(s)


This post has been edited by patelkarn: 28 January 2010 - 10:59 AM


Is This A Good Question/Topic? 0
  • +

Replies To: C++ to raptor flowchart

#2 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: C++ to raptor flowchart

Posted 28 January 2010 - 11:01 AM

...um... have you used Raptor at all? Do you know C++ at all?

This is REALLY easy... ***REALLY*** easy... I think you should give it a shot, I bet if you actually tried you could do it all by your little-ol'self

note that cout << is how C++ prints things... that is about all you should need to know.

Maybe follow some of the raptor tutorials to get a hang of Raptor...
Was This Post Helpful? 0
  • +
  • -

#3 patelkarn  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 28-January 10

Re: C++ to raptor flowchart

Posted 28 January 2010 - 11:05 AM

well i have not use raptor a lot or c++ but i do have some knowledge about it the only thing that I am stuck is that if a use enters a number and i want to store that into memory for later use how i do that

hopefully you understand what i mean
Was This Post Helpful? 0
  • +
  • -

#4 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: C++ to raptor flowchart

Posted 28 January 2010 - 11:06 AM

BTW: if you think my post was rude -- I am sorry... there are people out here on the internet who would not be even half as kind as I have been.

[rules][/rules]

Ah... so your question is: How to use a variable in Raptor?
Was This Post Helpful? 0
  • +
  • -

#5 patelkarn  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 28-January 10

Re: C++ to raptor flowchart

Posted 28 January 2010 - 11:08 AM

View PostNickDMax, on 28 Jan, 2010 - 10:06 AM, said:

BTW: if you think my post was rude -- I am sorry... there are people out here on the internet who would not be even half as kind as I have been.

[rules][/rules]

Ah... so your question is: How to use a variable in Raptor?


I attached my file of raptor its a screen shot that is what i made
Was This Post Helpful? 0
  • +
  • -

#6 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: C++ to raptor flowchart

Posted 28 January 2010 - 11:09 AM

Well... in C++ you have to declare variables... in Raptor you just have to use them...

a GET numItems block should allow you to store the number of items...

***moved to Other Languages*** since the question is about Raptor not C++
Was This Post Helpful? 0
  • +
  • -

#7 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: C++ to raptor flowchart

Posted 28 January 2010 - 11:28 AM

looking at the attachment it looks like you are pretty close... what is wrong with it?
Was This Post Helpful? 0
  • +
  • -

#8 patelkarn  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 28-January 10

Re: C++ to raptor flowchart

Posted 28 January 2010 - 11:46 AM

View PostNickDMax, on 28 Jan, 2010 - 10:28 AM, said:

looking at the attachment it looks like you are pretty close... what is wrong with it?


Thank you so much for supporting me I give a lot of thought and finally make it to work here is my code


#include <iostream>
using namespace std;
int main()
{
   int x;
   int items;
   float average;
   float num;
   float sum;

   cout << "Please enter how many numbers you want to add: ";
   cin >> items;
   sum =0;
   x =1;
   while (1)
   {
	  
	   cout << "Please enter number " << x << ": ";
	  cin >> num;
	  if (x==items) break;
	  x =x+1;
	  if (x==2)
	  {
		 sum =num;
	  }
	  else
	  {
		 sum =num+sum;
	  }
   }
   sum =sum+num;
   cout << "Items = " << items << endl;   cout << "Sum = " << sum << endl;   average =sum/items;
   cout << "Average = " << average << endl;
   return 0;
}

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1