473,372 Members | 851 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,372 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 3384
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.