Sponsored Content
Full Discussion: c++ string prob
Top Forums Programming c++ string prob Post 302344051 by rave03 on Friday 14th of August 2009 12:20:37 PM
Old 08-14-2009
c++ string prob

hi could some body help me?
im making a program that writes in a file.txt
how can i compare my "char x" to another char?

Code:
#include<iostream>
#include<fstream>
#include<string.h>
using namespace std;

int main()
{

char x[100]; 
char y[100];





cout << "enter title" << endl;
gets(y);
ofstream rave(y, ios::out);

cout << "enter word" << endl;
do
{
gets(x);
if (x!= (?))  // <= i need something that "char x" could be compare to so //that my  if comd will execute
{
rave << x;
}

}while(x != (?)); // <= same above

rave.close();

}


Last edited by Franklin52; 08-15-2009 at 08:11 AM.. Reason: cleanup urls and adding code tags and approve post
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

prob

When i am trying to $uncompress tress.dmp.Z I am getting tress.dmp.Z permission denied. What action i have to perform to unzip or uncompress It has rw-r--r-- permissions When i am trying to change the permissions chmod 744 it says. chmod: Warning: can't change tress.dmp.Z Just... (1 Reply)
Discussion started by: dreams5617
1 Replies

2. UNIX for Dummies Questions & Answers

grep prob

hi, how can i saerch for foll pattern the line contains many entries: xxx xxxx ddd ffff gggg 30% rr eeee eeee rrrr rrrr 100% rr eeee eeee rrrr rrrr 43% how can i display lines having size greater than 40%?what pattern shud i use in grep? thanks! regards vivek.s (1 Reply)
Discussion started by: vivekshankar
1 Replies

3. UNIX for Dummies Questions & Answers

cronjob prob

Hi all I am getting the following error when i execute my cronjob : stty: : No such device or address stty: : No such device or address What could be the problem. Thanks Rahul (3 Replies)
Discussion started by: rahul123_libra
3 Replies

4. Shell Programming and Scripting

prob with ssh

I am executing this on say host1 export dn=/home/abhi export fn=file\"*\" file_path=$dn/$fn set -A files $(ssh host2 "eval echo $file_path") echo files= ${files} So the purpose is to store in array "files" .. the o/p of cmd executed in host2... this script works fine if the files r... (1 Reply)
Discussion started by: abzi
1 Replies

5. UNIX for Dummies Questions & Answers

prob's with while loop

Hi Gurus, I have a requirement where I have files in a folder For example in home/input i have files 20080111.06.12.45_abc.xml 20080112.06.10.48_abc1.xml 20080113.06.08.55_abc2.xml 20080114.06.12.35_abc3.xml Actually i will get the files as abc.xml , i rename & put it with timestamp.... (2 Replies)
Discussion started by: pssandeep
2 Replies

6. UNIX for Advanced & Expert Users

NFS prob

Hi all, i want mount directory with permission #NFS Server = FreeBSD /etc/export = /data -alldirs -network 192.168.0.0 -mask 255.255.255.0 #NFS Client = Ubuntu 192.168.0.8:/data /dir nfs intr but i m unable to create folder in /dir whts the wrong? Please... (4 Replies)
Discussion started by: jagnikam
4 Replies

7. Shell Programming and Scripting

sorting prob

my sample is 01012007 01022007 02022007 01032007 20022007 02032007 01092007 05022007 30022007 which is date in ddmmccyy format i try to sort like this sort -n +0.2 -0.5 +0.0 -0.3 file but the results are not correct pls help...... (3 Replies)
Discussion started by: paresh n doshi
3 Replies

8. Solaris

mount prob

# mount /dev/dsk/c1d1s1 /mnt mount: /dev/dsk/c1d1s1 is not this fstype I tried to mount the above raw patition and it gave an error. but can someone help (3 Replies)
Discussion started by: seyiisq
3 Replies

9. Solaris

Solaris 8 prob

Pls tell me how can i recover adeleted user in solaris 8. Please help me I'm a newby thanks aamer (4 Replies)
Discussion started by: aamer
4 Replies

10. Windows & DOS: Issues & Discussions

Prob. with using as86

Hi, I have downloaded as86-0.16.17.tar file. When I umcompressed it I found it consisting of C source and header files. How can i create an executable for compiling assembly programs. Kindly help me with this. I am working on windows XP professional and system is HP DX 2700. Zulfi. (0 Replies)
Discussion started by: zak100
0 Replies
FBB::repeat(3bobcat)					      repeated function calls					      FBB::repeat(3bobcat)

NAME
FBB::repeat - call a (member) function a fixed number of times SYNOPSIS
#include <bobcat/repeat> DESCRIPTION
The FBB::repeat function template allows a function or member function to be called a certain number of times. The functions or member functions may define arguments. Arguments to these functions are specified when repeat is called, and are perfectly forwarded by the repeat function template to the (member) function called by repeat. The first argument of the repeat function template defines the number of times the (member) function must be called. The FBB::repeat function template are defined inline, allowing the compiler to `optimize away' the repeat function call itself. NAMESPACE
FBB All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB. INHERITS FROM
- REPEAT FUNCTION TEMPLATE
The repeat function template is declared as: template <typename Counter, typename First, typename ...Params> void repeat(Counter counter, First &&first, Params &&...params); In this declaration, o Counter represents the counter's type. Usually an int or size_t. When calling repeat counter must be initialized to the number of times repeat must call the (member) function (see below); o First represents the prototype of a function or the name of a class. name of a class. Likewise, first either is the address (name) of the function to be called or the name of an object of class type First. In the latter case the object may or may not be a const object. o ...Params represents the set of parameter types of arguments which must be perfectly forwarded to the called function. If first rep- resents a class type object, the first argument must be the address of a member function of the class First. EXAMPLES
#include <iostream> #include <iterator> #include <algorithm> #include "../repeat" using namespace std; using namespace FBB; class Object { public: void member(int argc, char **argv) const; void member2(size_t &rept, int argc, char **argv); }; void Object::member(int argc, char **argv) const { cout << "member called "; copy(argv, argv + argc, ostream_iterator<char const *>(cout, " ")); } void Object::member2(size_t &rept, int argc, char **argv) { cout << "member2 called, iteration " << rept++ << " "; copy(argv, argv + argc, ostream_iterator<char const *>(cout, " ")); } void fun() { cout << "Fun called "; } int main(int argc, char **argv) { Object object; cout << " " "*** The number of arguments determines the repeat-count *** "; cout << "Fun without arguments: "; repeat(argc, fun); cout << "Object receiving argc and argv: "; repeat(argc, object, &Object::member, argc, argv); cout << "Object receiving argc and argv, showing the iteration count: "; size_t count = 0; repeat(argc, object, &Object::member2, count, argc, argv); Object const obj; cout << "Const Object receiving argc and argv: "; repeat(argc, obj, &Object::member, argc, argv); } FILES
bobcat/repeat - defines the class interface SEE ALSO
bobcat(7) BUGS
Be careful when using overloaded functions, as the template argument resolution mechanism may be unable to determine which function to call. If overloaded functions must be used, a static_cast is likely required to disambiguate your intentions. DISTRIBUTION FILES
o bobcat_3.01.00-x.dsc: detached signature; o bobcat_3.01.00-x.tar.gz: source archive; o bobcat_3.01.00-x_i386.changes: change log; o libbobcat1_3.01.00-x_*.deb: debian package holding the libraries; o libbobcat1-dev_3.01.00-x_*.deb: debian package holding the libraries, headers and manual pages; o http://sourceforge.net/projects/bobcat: public archive location; BOBCAT
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'. COPYRIGHT
This is free software, distributed under the terms of the GNU General Public License (GPL). AUTHOR
Frank B. Brokken (f.b.brokken@rug.nl). libbobcat1-dev_3.01.00-x.tar.gz 2005-2012 FBB::repeat(3bobcat)
All times are GMT -4. The time now is 05:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy