473,408 Members | 2,405 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,408 software developers and data experts.

C++ Output

Hi all,

I'm really having a problem, and it is in the output results.

There are basically two loops. I want to set the first loop to be in the ouptput in the second loop.

Here is my code:

//first loop
for (int c = 0; c < wordcount; c++) {
for (int g =1; g < wordcount; g++) {
if (word[c] == word[g] ) {
cout << Dictionary[g-1] << endl;
}
}
}

//second loop
for (int i = 1 , L = 0; i <= wordcount , L <= wordcount; i++ , L++) {
cout << word[i] << " " << Dictionary[L] << " " << endl;
}

that is to be like this:

for (int i = 1 , L = 0; i <= wordcount , L <= wordcount; i++ , L++) {
cout << word[i] << " " << Dictionary[L] << " " <<
for (int c = 0; c < wordcount; c++) {
for (int g =1; g < wordcount; g++) {
if (word[c] == word[g] ) {
cout << Dictionary[g-1] << endl;
}
}
}
<< endl;
}


I tried to include them in a while loop but its not working.
hope one of you guys will help me out.

Thanks in advance.
Nov 28 '06 #1
3 1685
Hai Melaghil,
I dont understand any thing from your code. please can you clearly explain your problem.

Cheers
K.Kiruba.
Nov 28 '06 #2
Thanks for you reply, and sorry for my uncleared wiritng as i was in a rush.

here is wt the program does.
Part 1:
You have a list of the dictionary words stored in a text file. the program takes the words line by line, and sort them in alpahpetical order (anagram),
so if we have a word called lemon then the output is in this form.

elmno lemon

and thats wt is done by this loop

for (int i = 1 , L = 0; i <= wordcount , L <= wordcount; i++ , L++) {
cout << anagram[i] << " " << Dictionary[L] << " " << endl;
}

Part 2:

sometimes a word like monel have the same anagram as the word lemon, if this case happened then the output should be like this

elmno lemon monel


the problem i have is, i have done part 1, and i want to combine both parts

here is the seocnd loop that i want to combined with the first one:

for (int c = 0; c < wordcount; c++) {
for (int g =1; g < wordcount; g++) {
if (word[c] == word[g] ) {
cout << Dictionary[g-1] << endl;
}
}
}

Hope will clear it more.

Thanks again
Nov 28 '06 #3
mohsin
19
hi
well would u like to tell me that what do u want from this code i mean i m still doubtfull about your code
thanks
Nov 28 '06 #4

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

Similar topics

4
by: Mark Wilson CPU | last post by:
This must be easy, but I'm missing something... I want to execute a Perl script, and capture ALL its output into a PHP variable. Here are my 2 files: -------------------------------------...
3
by: edgekaos | last post by:
Is method 2 valid? Method 1: wstring input = L"STRING"; wstring output = input; transform(output.begin(), output.end(), output.begin(), towupper); Method 2: wstring input = L"STRING";...
4
by: Kevin Mansel via .NET 247 | last post by:
Ok, basically this is my problem. I'm building a console app tocall a dos program. So i'm using the Shell command to call theprogram, now depending on what happens, I want to read theoutput that...
24
by: kalamantina | last post by:
#include "stdafx.h" #include <stdio.h> #define output( x ) printf( #x "\r\n" );fflush( stdout ) class CMyBase { public: CMyBase() { output( CMyBase() ); f(*this);
0
by: newbie | last post by:
i'm a newbie of c language. can anyone help me to implement the code so that I can get the ciphertext from the output. thanks. #ifndef _3DES_H #define _3DES_H #ifndef uint8 #define uint8 ...
32
by: spibou | last post by:
Is the output of the C preprocessor deterministic ? What I mean by that is , given 2 compilers which conform to the same standard, will their preprocessors produce identical output given as input...
3
by: MatsL | last post by:
Hi, This is seriously driving me crazy, could anyone explain to me why neither of these doesn't produce XHTML compliant output (it is being called in Render() btw): output.WriteLine("<img...
3
by: undshan | last post by:
I am writing a code that needs to open a file, create an output file, run through my function, prints the results to the output file, and closes them within a loop. Here is my code: #include...
5
by: amit.uttam | last post by:
Hey everyone, I've recently jumped big time into python and I'm working on a software program for testing automation. I had a question about proper logging of output. What I would like is: 1....
2
by: gabosom | last post by:
Hi! I've been breaking my head trying to get the output variables from my Stored Procedure. This is my SP code CREATE PROCEDURE GetKitchenOrderDetail( @idService int, --outPut Variables ...
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?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.