OK ^-^ I`ll try not to use to many smileys.eh... it`s so hard to program in c... I cant make the programe work ...
So format it and post the new version. And ask specific questions about it... Complaining about C gets us nowhere.
OK ^-^ I`ll try not to use to many smileys.eh... it`s so hard to program in c... I cant make the programe work ...
So format it and post the new version. And ask specific questions about it... Complaining about C gets us nowhere.
I am not allowed to use islapha function since its not been taught yet.
Each character has a numerical value. Therefore you can simply compare characters. For example, to see if the character ch is a digit, you can use: if (ch >= '0' && ch <= '9')
If true, it's a digit.
Oh.. I forgot to asc... whether this programe is in C language??... If not I have I problem :( I need a programe in C..... ;(
Please learn to Format your code. Yours is hard to read.
To convert to C simply use printf()
for output, and fgets()/sscanf()
combination for input
Oh, and :confused: stop :mad: using :confused: so :mad: many :confused: smileys! ;)
They are not necessary and just get in the way.
can u send me the correct prog...
i want to see how it really works
No. Read this
sir i am still amaeture could u please helpme in this prg.
this is the first time ..
can u telll me what is my mistake
if i write
for(i=1;i<=4;i++)may be then it will work.
what do you say
Depends on what you want the program to do...
We are still waiting for an explanation of your problem. Rather than beg for help, explain what your program is doing wrong, and what it should do correctly.
It's a convoluted way of clearing the input buffer of characters left after the previous read. When you read a number using cin
, the characters after the number are left in the buffer for the nect cin
to read. That basically means the ENTER is still there, and when you attempt to read a string, the first thing it sees is ENTER, so it's happy. That convoluted cin.ignore()
clears the buffer.
It's a bandaid that's necessary because cin
is a relatively misbehaved command. It's ultimately better to read a full line using getline()
and then parse the line into it's components.
Aia, what did you just post? No explanation, no formatting, improper programming practices ( void main()
, getch()
, clrscr()
)
You should model good practices and proper techniques. You seem to have been here long enough to know this... ;)
hey, how bout if u try to make it outtextxy(13,13,"a") instead......this function, as far as i know doesn't work without quotes.......
I think it might be.
outtextxy(13,13,"a")
All you need to do is read his request:
Now am trying to display something the user enters onto the graphics screen. like if am accepting his initial into 'a' and want to display it. How should i do it
'a' is a variable. It contains what the user typed in. You don't use double quotes around a variable if you want to display what was entered. abhijit11 used the function correctly -- unless he defined 'a' as a single character. But we don't know that. ;)
plzzzzzzzzzzz read the forum rules, especially
thread titles & homework requests (you want us to finish it for you?)
Code Tags and Formatting C / C++ code (you want us to read your code?)
ok i am new to programing what does that mean? (Look into the modulus (%) operator. That will give you each digit starting in reverse order.)
Open your book. Last few pages are an index. Look there.
If you're no using a book (for shame!), ever heard of GOOGLE?
It doesn't matter how new you are. You still have to look stuff up somewhere. :rolleyes:
no i got it to print the sum out, now i need to know how to printt the sum out backwards. example if the sum = 23 i need tot know how to make it print out 32 which would be the reverse order. if u run my program u will see what i mean.
Please use full English, not webspeak. Many people here come from non-English speaking countries and it's easier to read real words.
Look into the modulus (%) operator. That will give you each digit starting in reverse order.
>>if anybody knows how to check text for a specific string and then change it or create a message box(ie. swear detecter)
If you are looking for a way to detect obscene language, you might ask Dani because she implemented something similar for DaniWeb a couple months ago. I don't know enough about it to describe how its done.
okay thanks, but is that for any script or...? cause im lookin for it to be done in vb6... thanks a whole bunch
A technique is just a technique. It can be written in any language.
Essentially you have a list of words you are looking for in an array. You then loop through the array and search for each word in the text.
I must be looking at this completely wrong because to me it looks like you pass the sum and cBit into the function, but I though that is what the function is suppose to produce.
sum and cbit are values returned back to the calling function. Your function will load these values with the answers.
I am confused with pointers and references, I dont really understand why they are being used in this situation.
Because the instructor said so. ;)
Pointers are simply another way to access an array. Read up on them and ask specific questions about them and we can help you. This link has some information about pointers vs. arrays.
ok my program works the only thing i cant figure out how to do is, print the sum,
Maybe you can use cout <<"The sum of the numbers is : " << sum << endl;
;)
... average
Average is sum / #-of-values
ok i got the numbers to print out in reverse order but i can getthe sum and average to print out in reverse order. anyone got anything for me.
Sure. Since you are already outputting the sum, why can't you output the sum? And how do you print a sum and average in reverse order?
But to fix a couple things:
#include "stdafx.h";
#include <iostream>
#include <string>
using namespace std;
int numbers, sum, average;
int main()
{
int numbers[5];
double sum, average;
int counter;
cout <<"Enter five numbers: " << endl;
sum = 0;
for(counter = 0; counter < 5; counter++)
{
cin >> numbers[counter];
sum = sum + numbers [counter];
average = sum / 5; // you can't calculate the average in the loop
// move this outside the loop
}
cout << endl;
cout <<"The sum of the numbers is : " << sum << endl;
cout <<"The average of the numbers is: " << average;
cout << endl;
cout <<" "<< endl;
cout <<"The numbers you have entered reverse order: " << endl;
// Use a loop here, like your input
cout << numbers[4] << endl;
cout << numbers[3] << endl;
cout << numbers[2] << endl;
cout << …
#1: You don't need to double space everything. It's too hard to read.
#2: You need to indent consistently, and 3-4 spaces, not 1 or 2
#3: "it is bringing some bit of a problem" has no meaning. What is the problem. Describe it, don't make us guess.
Heres the code I know the indention is terrible but hopefully u would understand:
Then why not take 30 seconds and make it neat so we don't have to struggle to understand the code. Don't post terribly formatted code you know is bad -- fix it! :rolleyes:
First of all, you'll have to figure out how to read a character at a time (without the need for ENTER) which is not standard. I think GCC can do it but you'll have to figure it out yourself.
Then you'll have to grab the name of each file in the directory that matches what was typed so far.
Then you have to replace what was typed with the filename found. This generally uses a graphics library so you can move the cursor where you need it, also non-standard.
One way to implement this is to:
When TAB is pressed, find the files, output the first file name.
If another TAB is hit, change to the next file name.
If different key is pressed, redisplay what was entered and add that keystroke to the input.
3. Optimizing the breaking conditions in for loops. If you know that the loop variable's range is from 0 to some +ve number AND it doesn't matter which way you traverse while looping, you can optimize the loop like this:
//original loop for( int i = 0; i <= 30; i++ ) {/*do your stuff*/} //optimized loop for( int i = 30; i--; ) {/*do your stuff*/}
Except if your description is true, you'd be better off using
i = 30;
while (i--)
{
/*do your stuff*/
}
been found most
falling on their
touche
That storm, with the name of Azrothic, has just landed and is making her way towards the village, to retrieve her demon child lost these many months on this foreign shore. May those that have the child be in good stead with their Gods, for the consort of hell on earth will find her spawn and destroy all those in her way.
ok but does anyone know how i would make it not pass a zero if the first number is zero after it been reverset. for example 1230 shoul be printed out as 321 and not 0321.
Sure. When you start outputting the values, check for a 0. If there is one, don't output it. Keep testing until you don't find a zero. Once you output that first non-zero, stop testing and just output to the end.
Nurse Diesel ran to her room, crying. Meanwhile, Sherman in his office had no idea Caroline wanted to see him. If Reviak would only emerge from his drunken stupor and remember his task, all would be well.
For right now don't worry about it. Verification of input will probably be later in the course.
silt
Say something, don't just stand there like a mute!
switch (xactCode)
{
case 'D': case 'd':
bal += xactAmt ;
depAmt += xactAmt ;
totDep++ ;
case 'I': case 'i':
bal += xactAmt ;
intPaid += xactAmt ;
case 'W': case 'w':
bal -= xactAmt ;
wdAmt += xactAmt ;
totWd++ ;
if ((bal < MIN_BAL) && (svcChgd = false))
{
bal -= SVC_CHG ;
svcChgd = true ;
}
default:
outfile << endl << "!! INVALID TRANSACTION CODE !!" << endl << endl ;
}
Look up the requirements for a switch/case
segment. You have a very important piece missing in each case
.
If you are an addicted ebayer then:
The Original: http://www.youtube.com/watch?v=lQTFdrZFI2g&mode=related&search=
and somewhat sad
into, so just
Strictly adhere to the guidelines or the large security dude will stop you flat.
Never done this before, but here goes...
I write VB6 applications and have had little problem installing them on computers at office sites scattered across the country. Now the IT people are putting the clamps down on "non approved" apps and will not give anyone admin rights to the pcs. Is there a way to install an application on a USB drive that can be used on any computer? I tried it once but there are files that need to be referenced in the registry, which won't work. Is there a way to make an exe file that contains all of the objects and app extensions built into it or a way to just tell the app these additional files are in the same folder as the application?
Nope. VB uses too many dll's and ocx's and such that have to be installed into a system to be useful.
I long for the days of creating an exe, placing it in a folder and off we go! But that may date myself.
You and me both! Those were the days, my friend!
How about:
Read a string as ~sos~ suggests.
Convert the string to int
If it a valid value, use it, else output error
If you're going to use char arrays, you might as well be using C. And no, I know it's not your fault, so I blame your teacher for that.
Seems to me the concept here is to learn to process c-strings, because they are necessary in C++.
earlyriser, stop using any and all functions that have a definition of string and use only char* functions. Help us save Joe's sanity. :)
Moo-cows, shmoo-cows -- pass the steak!
only one with
of 200 electric
Also, your coinToss()
function needs to be formatted properly. It'll only take you 30 seconds... ;)
Sorry I havn't replied sooner, but I've had work today :sad:
No problem. It's not like I was waiting by the computer just for you :mrgreen:
Anyway, thanks for the suggestion; To think, I've got experienced with AI yet I can't deviate, figure and reckon that 8 tests would be better than 4!!!!
It all comes with more time and more experience. I remember one program I wrote with multiple nested for loops (15 I think) -- took over 3 pages and a couple bad practices. Less than a year later I rewrote the entire program to less than 1 page. Knowledge can come at you fast...
cin >> setLocation; switch (setLocation) { case 0x41 : px = 0; py = 0; break; case 0x42 : px = 1; py = 0; break; case 0x43 : px = 2; py = 0; break; case 0x44 : px = 0; py = 1; break; case 0x45 : ... py = 2; break; }
This whole section can be reduced to 2 simple equations. Hint: Subract 41 from setLocation and look at division and modulus operators...
Does that look right? I'm still open for suggestions and I've got some ideas of my own I'll post later on, but I'm freaking tired.
If it works, it's (probably) right. I didn't look at the whole thing, but the above jumped out at me big time...
i am just taking this class for one semester but i need help..am i doing this right at all? or should i redo it in another way thank you suroot. ~Fara
Posted on Dec 14th 2004I created a seperate subprogram for each player for most aspects of the game. The into screen may not work on some computers if it doesn't you can just delete the part that writes "Tic Tac Toe" onto the screen.
Here is the code for the program. Please don't just copy it. Try to figure out what I did and why yours isn't working.
This must be on loooooooooooooooong semester, over 2 years :surprised
But it's yogurt! If I want spoiled milk I'd just leave it in the fridge for a while.
his singing is
undusty
... but it stop reading at the first line and not jump to second line. Could you help me at this point?
thank you!
Since the only code you posted above is ADragon's code, and his works fine, we have no idea what's wrong with yours.
With this solution you are checking 3 colums, 3 rows, and 2 diagonals. IOW 8 tests.
If you pass in the last move, you can check 1 row, 1 col, and 0, 1, or 2 diagonals. For this, a maximum of 4 tests. To check to see if a diagonal has to be tested,
if both indexes are 1, both diagonals must be tested (center square)
else
if either index is 1 there are no diagonals (side square)
else
test one diagonal (corner square)
Here the entry level salary is around 8K USD per annum (when converted from INR). Very less I guess compared to other countries. No wonder everyone wants to move out...
And no wonder many US companies contract a lot of work there... :confused: