WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Rewrite your calculation section so it's doesn't use tricks. Make it straight forward and simply output each calculation.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

What J is trying to say with his "I know more than you" attitude is there are many NEW compilers that are available free and since the last Turbo compiler is 20 years old you should consider an updated compiler -- still free. That way you can concentrate on Standard concepts and not teach things that are not available in the industry.

jephthah commented: LOL you always make an effort to insult me, even while agreeing with me. I'm flattered that i affect you so deeply. :hugs: +0
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

wow, i could change my name and my picture and i would be like a completely new person that no one would know who i am!

An episode of the original Star Trek immediately pops into mind...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Where did you accept the grade?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

After you read the last number, you still have the end-of-line in the file. here's where getline() can clean up the EOL. Since you didn't describe in detail what's really happening with the second line, that's my guess.

But using getline() to read each line and parsing the line is still the better solution.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

i already put my code , actually my code didnt work , therefore i need from u to help me to repair it to work , i already tried many time to work on it.
my code is beneath my question immediate, so you can look to it

We answered you. We said:

There is no formatting making the code difficult to read.
There is no description of what you are having problems with.
There is no information about what is confusing.

This means that even though you posted code it is unreadable.
You didn't explain what you are having problems with

Don't you think it is a good idea to tell us what you've tried, what you suppose could be wrong and other information like that?

Repeats my complaint that you didn't explain what you are having problems with.

Therefore, we already answered you. Fix your question...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

There is actually a very simple solution to this problem. First, you are trying to do two things here:

1.  Split an input number into separate digits.
2.  Add the digits together.

First of all, I would not recommend putting your input into an int type. If you do this, you have to split each digit using modular arithmetic. While this is mathematically elegant and very pleasing aesthetically, it is not the optimal solution here. Instead, one could store the

My guess is this is exactly what the instructor wants. It teaches a technique very important to computing.

Read a value into an integer.
Use the modulus operator % and division to split the input into separate values, an array would work best.

>>I want to my program to prompt user to input a number with three or more integers

You know how to get the user input into a variable right ?

int var1 = 0 , var2 = 0, var3 = 0;
cin >> var1 >> var2 >> var3; //get 3 inputs from the user

Won't work. Try it with an input of 321.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

you need to look up the parameters for rand(). You obviously missed something.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

'y' and 'n' are already characters. You cannot define them as char

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

i got errors and i cant find out what they meant i have went down the program line by line trying to figure them out and i am having no success. I am trying to use call by call values and parametrers n this program. (list of errors are below)

|error: at this point in file|

What point in what file?

error: a function-definition is not allowed here before '{' token|

Where is here?

|error: too many arguments to function `int rand()'|

This one is obvious -- if you can find the rand() statement.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Simply don't write the lines to the new file. That's it.

Ok, I understand that, but how do I skip over the 5 lines included in the character's information during the loop and continue running it afterward?

You obviously don't understand...

You don't skip anything.
You read and write everything up to the name you want to delete.
Now read but don't write until you've read up to the next name.
Now continue reading and writing.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

You've got the basic idea, you just misplaced your { }s. Reformat your code and you should see the problem.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

What did i do wrong

Didn't use CODE tags
Didn't tell us what problem you are having.

HTH

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I would like for the program to be able to "delete" any character and all of its information from the text file. I believe this involves reading and copying the text file until it reaches the characters name than skipping that line and the next four informational lines before it continues its reading and copying. I am just not sure how I would skip the lines.

Simply don't write the lines to the new file. That's it.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

@WaltP...i was just trying to help and he already wrote the program himself, i just showed him where he did wrong... i think there was no need to give me a negative feedback....just my two cents...:icon_neutral:

No you didn't. You never pointed showed him his error. You simply posted (allegedly) working code with the statement

well...none of you gave the solution..so i'm giving it...correct me if i'm wrong...

you state yourself you are giving the solution. Also, he never responded so you have no idea if he ever got correct code.

And you did ask to be corrected if you were wrong -- I corrected you.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

You need to completely understand the .doc format in order to split a document properly. Do you understand the headers and all?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

First thing is var is a reserved word. Don't use it as a variable.
Second, you went to the trouble making IsEvenNumber() but you don't call it.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

alright thanks, but how would i use a loop then? not like that?

for (i=0; i<50; i++)
	{
		c=isalpha (s[i]);
		if (c!=0])
		{
			alpha++;
		}
		
	}

Yes. Although I'm make it more compact with:

i=0;
    while (s[i])    // Until the end of the string
    {
        if (isalpha (s[i]))  alpha++; 
        i++;        // Next character
    }
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

It is what my compiler says. It is the error.

Oh, that explains all. Then the solution is get rid of the error.

You need a better compiler that tells you what the error actually is. Get rid of the one you're using if all is says is "This is an error". You need better messages than that.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

What's with all the [*]s??? Stop trying to be cute.
Set nums = 0 in the function, not as a global. Keep your values where you need them.

It helps to explain what the problem is, not just tell us there is one. We do't know your program, data file, nor task. Without details we're only guessing -- like I did above.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

No, a statement is bolded and underlined. The error is missing -- you have to post it.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Your understanding is faulty. You cannot pass a string into the isxxx() functions. You pass in a character and the return is non-zero for TRUE and 0 for FALSE.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

What is the value of nums when you enter ReadData()? It's probably not what you expect.

And don't be so pushy. 4 minutes is way too short to start bumping. As a matter of fact, bumping is rude and should not be done anyway.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

This is why you can't do what you posted.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Helping you is kinda like pulling teeth. You completely ignore suggestions like exit(1) => return 1, you give useless information like

ok I have the loop and everything but whenever i print it out it jsut gives me location at 0,1,2,3,4,5,6 i think its my logic...

and expect us to know where your problem is and what it is. If you would post the relevant code, or at least tell us where the problem is, and post details, we might have some ideas.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I'm confused too.
There is no formatting making the code difficult to read.
There is no description of what you are having problems with.
There is no information about what is confusing.

Therefore, I have little to offer.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

What do you mean by process?Is it some sort of pseudocode or u meant design of program?

Design.

if u meant design i had in mind that it needs to have sort of firewall,that will block any other programs/pages that weren`t allowed by mentor.I also though about a scheduler,which will allow student to use particular programs on certain days of week.

What kind of firewall? Do you know how to make one?
What kind of scheduler? Do you know how they work?

And I always wonder what countries teach that in English sentences are all run together. Don't they teach that after ?.,! and so on there is always a space? It's used to make text readable.

And u is not a word. It is spelled Y-O-U. Please...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Start by describing how you can tell if a number is prime.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

And you want us to do it for you?

That's not what we do here. You write it, and we help you fix it.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I think you should start over and concentrate on only the input. Think about how you need to loop and display your values at every point. Once you get the the end of the the file, output your matrix and make sure it's right.

Then, and only then, move to the next task.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

All programs start with a clearly defined concept and clearly defined design. Do you have a clearly defined process for keeping someone on task?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

So perhaps time has existed in one state or another for ever.

I think you're right. We had time when I lived in Michigan. Now that I'm in Minnesota, time seems to work here, too.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I think im gonna do Win32 api, i just need to find c++ tutorials, not ones in c

Win32 api should work the same in C as C++. All you need to do is call the functions properly from your C++ code. The C tutorials should help you just fine.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

We need to get some better information.

You've been bouncing all over this program for 4 pages and still don't have your file input working right yet? In your first post you say

The main problem i am having is the storing the file character by character into the 3D array.

Your last post (#32) says:

i want to input the text file, character by character, in the array but i seem to be getting, problems...

After all this help, why is your input not working yet? Haven't we been helpful at all? Ignore everything else and get your input working!

Another problem is this -- you say (again)

i want to input the text file, character by character, in the array but i seem to be getting, problems...

Do you need more help with your problems? If so, do you think describing the problems might be beneficial?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Confused with what? Is the saleamount equal to the GNP? Does it crash your computer? Does it make bad coffee?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Can someone please explain why this function will not compile.

It would be better if you explain why you think it doesn't compile. I assume the compiler says something to lead you to that conclusion. By posting what it says, we can tell you exactly why, and we won't have to guess.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

C and C++ are designed around standard keywords, functions, and headers as defined by The Standards Committee, or whatever they are officially called. Many (most) compilers will add additional functions they like. These are usually functions they feel were missed by the Standards committee. They may add them to a standard header or they may create a header specifically for these functions.

conio.h is the most notorious of these headers. And because of that, new programmers who are introduced to conio.h tend to wonder what's wrong when they switch compilers. "Where's my darn function" is their mantra. I know, because I was one of them.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Because it's a standard header.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Biggest difference is tolower() is a standard function and strlwr() is specific to certain compilers, non standard. tolower() converts 1 character. strlwr() converts a string

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I believe the Format function will help.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

So do the double quotes mean string literal while the single quotes get interpolated?

And that fixed it, danke.

Not quite.
Double quote is a string literal,
Single quote is a single character.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Try adding the % sign before the word calories in your output string.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Hey everyone here are my updated errors, and code, i have gotten them down too three now

Errors:
1>assign10.cpp(273) : error C2065: 'Start' : undeclared identifier
1>assign10.cpp(274) : error C2065: 'Start' : undeclared identifier
1>assign10.cpp(275) : error C2065: 'Start' : undeclared identifier

break the error down into pieces:
Start -- must be something wrong with it
undeclared -- what does this word mean?
identifier -- what about this word?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Hey there guys,

First time poster here, so I apologize for being a rookie.

Then you should have been posting for the past year. Then you wouldn't be a rookie :icon_mrgreen:

This is my first VB class and im having a hard time with For-Next loops.

As you can see it is only an issue of having the maximum number of stars on top, rather than at the bottom. I figure the issue is just reworking the loop, or adding another nested loop, but I am having a hard time finding the solution.

You aren't having a hard time. you're second-guessing yourself. You already know the answer (bolded above).

You need one loop for each line. Within that loop you need another loop for each '*' on that line.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

If I go to the US (33 years since my last visit!), who should I tip? I realise taxi drivers, waiters, porters, bellboys, busboys (or whatever they're called), consierges, coffee vendors, pizza delivery guys (only if their face looks less like a pizza than their product though) - but who else? Who decides? Is there a manual or a "bewildered's guide" for who you should and shouldn't tip?

Try these....
http://artofmanliness.com/2008/06/24/gentlemans-guide-how-much-should-tip/ (note the address on this one :icon_wink:)
http://www.getrichslowly.org/blog/2006/10/12/basic-tips-on-tipping-how-much-and-to-whom/
http://www.drdaveanddee.com/tipping.html

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Does anybody really know what time it is?

sorry...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

But just remember not to call your fake user Ancient Dragon Jr. Maybe Old Lizard or Decrepid Firebreather, something like that would hide your identity...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
cout << "So, type the missing number here: ";
cin >>f;
	if (f==5)
	cout << "Well done!\a\a\a";
	while (f!=5)
	{
	cout << "Wrong answer, try again!\nEnter the number here: ";
	cin >> f;
	}
    return 0;
}

Look more closely at this piece of code. If you enter 5, as you say it works fine. But if you enter 4 the first thing the code does is:

cout << "So, type the missing number here: ";
cin >>f;
	if (f==5)
	cout << "Well done!\a\a\a";

Nothing prints because f != 5
Then the program continues and executes this code:

while (f!=5)
	{
	cout << "Wrong answer, try again!\nEnter the number here: ";
	cin >> f;
	}
    return 0;
}

You enter the loop and keep asking for another number until f==5
What happens when you exit the loop? What's missing?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

sl is a string class, and strcmp() works only on char*.

Use the string class for owner and pass and you can simply use == to do the compare.