2,045 Posted Topics

Member Avatar for mucoool

You need to escape the backslashes with another backslash (just like using a backslash to escape double quotes and the like): [icode]system("c:\\new\\ram.bat"); [/icode]

Member Avatar for thomas_naveen
0
206
Member Avatar for kinglaplace6422

[quote]Write a program that will first fill two out of three parallel arrays (local to the main function) with user-supplied data and then give users the choice to query the parallel arrays. The first array is as follow: char title[SIZE_ROW][SIZE_COL]={"Intro to Calculus", "C++ Programming", "Java Programming", "Intro to Psychology", "Intro …

Member Avatar for jonsca
0
237
Member Avatar for PTRMAN1

Why have the while loop at all? You have the length of your input on line 17 and all the loop on line 20 is going to do is ask for more input. Use a for loop and march through the string by index (in [icode]string mystr = "abcd";[/icode] mystr[0] …

Member Avatar for PTRMAN1
0
127
Member Avatar for ryanleslie
Member Avatar for jonsca
0
98
Member Avatar for mucoool

Use strcpy to copy those values into the character array: [code] #include <cstring> //to access strcpy switch(col) { case 1: strcpy(text,"0x00000000"); break; //etc. } [/code] You can only assign text to a character array in the manner that you are trying when it is first declared.

Member Avatar for jonsca
0
284
Member Avatar for hag++

Does it rely on a file that it looks for in the same directory as the application? If so you need to copy that file from the debug to the release folder.

Member Avatar for mrnutty
0
263
Member Avatar for MTW1989

I would take a minute or two and get the formatting all straightened out (get stuff tabbed in and line up all the opening and closing braces with each other) and the answer should be evident. (Post 2000)-- ignore this

Member Avatar for jonsca
0
84
Member Avatar for fyp

It's doing exactly what you asked it to. You're having the program look for when the text has changed in the textbox (so if you type in any characters that event is firing with each one) and outputting the results to the file. You are getting the text of entire …

Member Avatar for jonsca
0
100
Member Avatar for roshantha08

You don't have to go through all this as Write() has an overload that takes a string directly. If you had to go the route you planned you can use the ToCharArray() method of the string to get the array that you need.

Member Avatar for jonsca
0
137
Member Avatar for rcard53762

[quote=Anarionist][code] //or if you wanted to call a function or variable without declaring an object //just like namespaces foo::color(RED); cout<<foo::x; [/code][/quote] This only works if the function or member variable is static so ignore that bit for a moment (see below for a link to more info). Otherwise you need …

Member Avatar for jonsca
0
122
Member Avatar for somaja

[QUOTE=somaja;1169097]i included these libraries: #include<iostream> //for i/o #include<fstream> //for opening files #include<string> //for strings #include<iomanip>[/QUOTE] Where does ReadData() come from then? I don't think that's included with any of these.

Member Avatar for somaja
0
212
Member Avatar for Fenlevi

Line 99: There's an issue with case sensitivity here. In one file you include the header as "Point.h" and in main you include it as "point.h". If that's not the case make sure that your class cpp is getting compiled before your main cpp.

Member Avatar for jonsca
0
137
Member Avatar for mitch9654
Member Avatar for mitch9654
0
64
Member Avatar for ndz-niels

A better way (though not the only way) to write it would be with a nested for loop: [code] for (int x = 0;x<=384;x++) { for (int y = 0;y<155;y++) { //this way you wouldn't need the int x=0 and int y=0 at the top [/code] because even if you …

Member Avatar for chetanbasuray
0
141
Member Avatar for juuuh333

Use Int32::TryParse instead of the Convert call. It's safer and it will return false if it fails versus throwing an exception. You'll have to have a tracking reference [icode] int % aout = a;[/icode] to get the value back from TryParse, but declare "a" as a regular old int and …

Member Avatar for juuuh333
0
3K
Member Avatar for fyp

Use a StreamReader object (in System::IO) to read in the text from the given filename as a string. You may be able to send it right to the textbox from there. Here's the code I used: [code] private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { OPEN DIALOG StreamReader^ sr = gcnew …

Member Avatar for fyp
0
652
Member Avatar for athlon32

You need dynamic_cast. For example [code] (dynamic_cast<Class1*>(b))->GetValue() [/code] will get you the value of 1 in your code. Use the dynamic_cast to convert your Base * object to a Class1* type (essentially you're just moving down the class hierarchy hence you used dynamic_cast and "downcast" the object) and now that …

Member Avatar for jonsca
0
139
Member Avatar for tinkeydo

Replacing line 29 with [icode] cin.getline(charName,50);[/icode] would be the best way to go. The cin.ignore helps in the situation where there are newlines ('\n', resulting from pressing enter after your input) left in the input stream. Since you would have the cin.getline statement first and then the cin >> there …

Member Avatar for tinkeydo
0
183
Member Avatar for Roo0ond

First, you need to learn how to format your code. Good that you got the code tags but what you have looks terrible and is hard to follow. Give this article a read: [url]http://www.gidnetwork.com/b-38.html[/url] Secondly, your switch syntax is completely wrong, you need colons after the cases not semicolons: [code] …

Member Avatar for jonsca
0
111
Member Avatar for ROTC89
Member Avatar for jonsca
0
1K
Member Avatar for aianne

[quote][icode]gets(String) ;[/icode][/quote] [u]Don't[/u] recommend the use of gets. It can take input until the cows come home and tries to write it all to that array--> overrun. Use fgets instead.

Member Avatar for Top9ne
0
1K
Member Avatar for rsg31

[icode] #include <time.h> [/icode] and you should already have stdlib because of rand(). At the top at some point before line 18 call [icode]srand((unsigned)time(0)); [/icode] to seed the random number generator using the current time (and converts that value to one acceptable to srand). A couple of little things: main() …

Member Avatar for thomas_naveen
0
188
Member Avatar for jephthah

[quote]What makes you think Narue is female? (s)he admits (s)he is a witch, so (s)he could be either or both.[/quote] [quote]But her profile says "Code Goddess"! And Dani is the most powerful on Daniweb . . the God of Daniweb. I'm convinced. [/quote] [U]Don't[/U] make me rethink my entire worldview. …

Member Avatar for jephthah
3
681
Member Avatar for BrandonB

I shouldn't reply since you keep bumping this... So what do you believe you have left to do? Looks to me like it's putting stars to head up the front of each of the rows and that you have to push some off the end those rows that receive extra …

Member Avatar for Fbody
1
572
Member Avatar for Samoht VII

[code] void swap(Record a, Record b) { Record temp = a; a = b; b = temp; } [/code] is not swapping the structs (as copies are being made). Try passing them by reference [icode]swap(Record & a,Record & b) [/icode] or by pointer.

Member Avatar for jimmyrat
0
117
Member Avatar for turrence27

I don't understand what you are trying to do on lines 14 and 16. The >> operator does not work with entire vectors like that. Also what's going on with your loops on 18 and 22? Check those loops by hand, if "i" starts at zero and it evaluates the …

Member Avatar for jonsca
0
2K
Member Avatar for The Dude

Frank Fontana? From Murphy Brown (sorry that's the first thing I thought of when I read that)? Wager a guess as to who's getting an alarm system as a very late holiday gift?

Member Avatar for jephthah
1
166
Member Avatar for stankit

You are trying some creative coding there. You need to make Yes a string and then compare it to "yes." For example, [code] cout <<"Enter another pt? "; cin >>Yes; if(Yes == "yes" || Yes == "Yes") //and any other variants you want { //do something } [/code] The fact …

Member Avatar for stankit
0
115
Member Avatar for callister

You got the code tags backwards, put them around your code and don't put them around your question. There's still time to edit.

Member Avatar for nezachem
0
297
Member Avatar for Sorb3t3ro

Does [URL="http://geekswithblogs.net/renso/archive/2009/10/21/how-to-set-the-windows-path-in-windows-7.aspx"]this link[/URL] help? (add your Borland directory to the path)

Member Avatar for Sorb3t3ro
0
243
Member Avatar for aianne

[quote][icode]gets(String) ;[/icode][/quote] [u]Don't[/u] recommend the use of gets. It can take input until the cows come home and tries to write it all to that array--> overrun. Use fgets instead.

Member Avatar for WaltP
0
152
Member Avatar for urbangeek

The extra '\n' from where you take in the number and press enter gets stuck in the input stream and carries down to your other prompt causing the wrong instruction error to come up (since '\n' !='y'). Here's a couple of tutorials to get you through the problem. Particularly read …

Member Avatar for urbangeek
1
557
Member Avatar for rihanphys

Use the sprintf function. It would look something like sprintf('apple%d.tiff',j); (I don't run matlab any more so I can't test it out) inside of a nested for loop [code] Outer for im1 = imread(sprintf('apple%d.tif',i); Inner for im2 = imread(sprintf('apple%d.tif',j)); Write corr2(im1,im2); into an i by j matrix (zeroed out before) …

Member Avatar for jonsca
0
142
Member Avatar for lionaneesh

Give [URL="http://www.daniweb.com/forums/thread244347.html"]this thread[/URL] a read. It goes into the specifics of why using scanf in the manner that you have isn't a good idea. Use fgets instead. Simple syntax: [icode] fgets(line,sizeof(line),stdin); [/icode]

Member Avatar for jonsca
0
73
Member Avatar for lionaneesh

In your second example you haven't noticed the additional space that's being put in front of the word. This could very well be any junk character because when you reference [icode] str[strlen(str)] [/icode] you overstep the bounds of the array. Remember, if your string is length 3 you're only going …

Member Avatar for jonsca
0
81
Member Avatar for nx86

Think of each letter of the alphabet as a number from 1-26. So a-z are just 1 thru 26. And aa = 1x26 + 1, ab = 1x 26 + 2, etc. zz = 26x26+26 = 702, aaa = (1x26x26)+(1x26)+1 = 703. So basically you would just parse the digits …

Member Avatar for jonsca
0
113
Member Avatar for restrictment

Check out the functions in ctype.h (include it as <cctype>). It has an [icode] ispunct() [/icode] function which you could use as you're moving through your array. See [URL="http://www.cplusplus.com/reference/clibrary/cctype/"]this for a reference[/URL] to all the functions in that header.

Member Avatar for restrictment
0
213
Member Avatar for Iamthedude

[code] Example_Struct * Foo::GetStructBar() { return structBar; } char * Foo::GetBar() { return bar; } [/code] Provided you have [icode] Example_struct structBar[10]; [/icode] (your array length here obviously) and [icode] char * bar[/icode] declared in your class. Make them Example_struct * and char * return variables in main also.

Member Avatar for jonsca
0
163
Member Avatar for fugnut

Your parameters of your prototype don't match the parameters of your function definition. You don't need the x,y,z that's going to be passed in,the function doesn't care about that, you need something like line 39. However, unlike 39 since it's a prototype you can omit the Array word, but leave …

Member Avatar for jonsca
0
115
Member Avatar for PDB1982

One other thing, might be an issue: [quote=Wikipedia] The exponent on a variable in a term is called the degree of that variable in that term, the degree of the term is the sum of the degrees of the variables in that term, and [COLOR="Green"]the degree of a polynomial is …

Member Avatar for jonsca
0
99
Member Avatar for tquiva

Remove all the stuff related to gs_A,B,C,D. You don't need them. You are passing in the thresholds for the grades, so use them. If I were to say, ok, answer in terms of s1, what is the highest grade acceptable for a B? What is the lowest grade (in terms …

Member Avatar for Aia
0
154
Member Avatar for samarudge

[quote]There's a guy with 3 legs =) [/quote] I thought his associate was attempting to moon the Google vehicle as it went by but missed the chance. Does anyone know what these cars look like? I've never seen one.

Member Avatar for Geekitygeek
0
171
Member Avatar for sandyjain

In that thread you specified, (I believe) Narue was saying that it was not a legal specifier for use with [I]printf[/I]. That is the correct format specifier for a double in [I]scanf[/I]. I thought she gave an explanation for that asymmetry at one point but I may be thinking of …

Member Avatar for Banfa
0
161
Member Avatar for *Moonlight*

Wrap from lines 6 thru (and including) 43 in a do/while loop. Instead of having the if and else if use c == 'y' as your condition of your do/while.

Member Avatar for jephthah
0
661
Member Avatar for gnarlyskim

What was the old way that you were using? I don't think there's anything wrong with the way you are reading input in this case. You could make the coef be a dynamically allocated array so it doesn't have to be set at 11.

Member Avatar for venkat arun
0
103
Member Avatar for balthy

I might think of it this way: For your second example you have 3/4 chance it will roll 2 and 1/4 chance of rolling a 6. For this specific case, get a random number between 0 and 4(exclusive of 4). If you pick 0,1, or2, you've rolled 2 and if …

Member Avatar for jephthah
0
2K
Member Avatar for ChrisXxX

OP seems to have record being passed in as a [icode]char*[/icode]. Shouldn't it pass in as [icode] struct PATIENT * record [/icode]?

Member Avatar for WaltP
0
109
Member Avatar for zrd0808

Dereference s before you try to get the c_str() method: [icode] c = (*s).c_str(); [/icode] since s is a pointer to string not a string. Or [icode]c=s->c_str();[/icode] will work too I just thought the other form was more illustrative for your benefit. Also, strlen won't give you the length of …

Member Avatar for zrd0808
0
2K
Member Avatar for msmedic

Try it with numbers first if you are stuck: 1 232 34543 Then figure out how to translate from the numbers to the letters of the alphabet. Here's a hint:[url]http://web.cs.mun.ca/~michael/c/ascii-table.html[/url]

Member Avatar for jonsca
0
114
Member Avatar for 726855

The End.