473,405 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Enable simultaneous looping

Ali Rizwan
925 512MB
How can i play to loops simultaniously.
For example

Expand|Select|Wrap|Line Numbers
  1. for(int i=0;i<=100;i++)
  2. cout<<"My name is ali";
and

Expand|Select|Wrap|Line Numbers
  1. for(int j=0;j<=100;j++)
  2. cout<<"Your name is ";
now both loops have to start at same time and play simeltaniuosly.

I m using Borland C
Version is 3

Thanx
>> ALI <<
Jan 14 '08 #1
10 3385
gpraghuram
1,275 Expert 1GB
How can i play to loops simultaniously.
For example

Expand|Select|Wrap|Line Numbers
  1. for(int i=0;i<=100;i++)
  2. cout<<"My name is ali";
and

Expand|Select|Wrap|Line Numbers
  1. for(int j=0;j<=100;j++)
  2. cout<<"Your name is ";
now both loops have to start at same time and play simeltaniuosly.

I m using Borland C
Version is 3

Thanx
>> ALI <<
If You want this to happen parallel then you should go for multi-threading.
You can use posix multi threading and i think POSIX is supported by Borland

Raghuram
Jan 14 '08 #2
sicarie
4,677 Expert Mod 4TB
And just out of curiosity (as the bounds are the same on each), is

Expand|Select|Wrap|Line Numbers
  1. for(int i=0;i<=100;i++) {
  2.    cout<<"My name is ali";
  3.    cout<<"Your name is ";
  4. }
not an option?

PS - Please check your Private Messages by clicking on the PMs link in the top right corner of the page. Thanks.
Jan 14 '08 #3
Ali Rizwan
925 512MB
And just out of curiosity (as the bounds are the same on each), is

Expand|Select|Wrap|Line Numbers
  1. for(int i=0;i<=100;i++) {
  2.    cout<<"My name is ali";
  3.    cout<<"Your name is ";
  4. }
not an option?

PS - Please check your Private Messages by clicking on the PMs link in the top right corner of the page. Thanks.
I m sorry but the code is not the same as there. This is an example.
Actually i have two animations and i want to run them simultaneously.
If i do as you are saying that combine them both then there is a big delay between them, that is why i want to run two loops.

Thanx

>> ALI <<
Jan 14 '08 #4
sicarie
4,677 Expert Mod 4TB
I m sorry but the code is not the same as there. This is an example.
Actually i have two animations and i want to run them simultaneously.
If i do as you are saying that combine them both then there is a big delay between them, that is why i want to run two loops.

Thanx

>> ALI <<
Ah, yes, well that is quite different, I would recommend looking into Raghuram's suggestion.
Jan 14 '08 #5
By using OpenMP API which is inbuilt in Visual Studio 2005 beta version


#include<omp.h>

#pragma omp sections num_Threads(n)
{
#pragma omp section
{
for(int i=0;i<=100;i++)
cout<<"My name is ali";
}
#pragma omp section
{
for(int j=0;j<=100;j++)
cout<<"Your name is ";
}
}


Asadullah ansari
Jan 15 '08 #6
Ali Rizwan
925 512MB
If You want this to happen parallel then you should go for multi-threading.
You can use posix multi threading and i think POSIX is supported by Borland

Raghuram
Can you tell me how can i do this?
I am novice in c++ and don't know too much

Thanx
>> ALI <<
Jan 15 '08 #7
Ali Rizwan
925 512MB
By using OpenMP API which is inbuilt in Visual Studio 2005 beta version

Asadullah ansari
I have mentioned the C++ compiler and version plz tell me associated with that.

thanx
>> ALI <<
Jan 15 '08 #8
oler1s
671 Expert 512MB
So, Ali Rizwan, I’m going to call you out as a help vampire as well. We told you that if you wanted to run two instructions simultaneously, you need to implement multithreading. Using various APIs like OpenMP can help.

We answered your question. So you come back here and say, how, how? Well, google it. The information is not a one line answer. It’s a serious topic, and we pointed you in the right direction. If you refuse to spend any effort on learning, then sadly, you aren’t the enlightened developer your avatar title says it is.
Jan 15 '08 #9
sicarie
4,677 Expert Mod 4TB
I have mentioned the C++ compiler and version plz tell me associated with that.

thanx
>> ALI <<
Ali-

Didn't we just talk about this? Pro-active means you actually try it yourself. Please take oler1s' post to heart, I would hate to have to take action against any member, but I PM'd you yesterday about trying to do things before you posted on them...
Jan 15 '08 #10
gpraghuram
1,275 Expert 1GB
Can you tell me how can i do this?
I am novice in c++ and don't know too much

Thanx
>> ALI <<

Look at this book which says about multi-threading in Linux.(Chapter 4)
Take a look and post me if you need mor info about this

Raghuram
Jan 16 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

19
by: Claudio Grondi | last post by:
I would like to save time copying the same file (>6 GByte) to various different target storage media connected to the system via USB. Is there a (Python or other) tool able to help me to do...
1
by: slugger | last post by:
Hope this is not OT: I am running into some strange things whenever my ASP pages send out simultaneous requests to another ASP page which in turn gains access to a MySQL database using a DSNless...
6
by: Jimnbigd | last post by:
I want to write a game, and sounds will really add to it. Note that I would always make the sounds optional. I hate it when I go to a URL and unexpectedly get sounds or music. I have played...
1
by: Semaj | last post by:
Environment: DB2 8.1.4; Windows 2000 We are evaluating the feasibility of upgrading our production DB from 7.2 to 8.1. During this process we've encountered an error when starting our...
1
by: Ed Chiu | last post by:
Hi, Is there a way to set webform controls to visible/invisible dynamically. Say I have a textbox cann txtFirstName, I know the following statement can set it visible: txtFirstName.visible =...
12
by: Dan V. | last post by:
Since an ASP.NET/ADO.NET website is run on the server by a single "asp_net worker process", therefore doesn't that mean that even 50 simultaneous human users of the website would appear to the...
1
by: Ryan Malone | last post by:
I have a situation where I need to download multiple files in a vb.net application. To speed up the process, I am trying to download multiple files at one time looping through each of the files...
3
by: vovan | last post by:
In a new WindowsForm project with default settings I wrote a loop: For Each frm In My.Application.OpenForms If frm.Name <"MDIMain" Then frm.Close() End If Next
1
by: AYasser | last post by:
Hi All, I am a VB.Net 2003 user and now upgraded to 2005. I have a Win application with a module as a startup object. The module enables me to close and open simultaneous forms while the application...
4
by: raylopez99 | last post by:
Compound question: first, and this is not easy, if there's a way to detect multiple simultaneous key presses in C# let me know (in the below code, keys c and d being pressed simultaneously or...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.