

InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
51. |
Solve : VBA (Excel 2000): using Cells(row, col) instead of Range("A1") in a Formula? |
Answer» HI guys, just need a relatively simple way to convert a Range to a CELL value for Formulas. EG. "=SUM(D3+D4)" INTO "=SUM(Cells(3,4) + Cells(4,4)" ' possible? The reason is i have soft-coded the column numbers into something like 'LastColumn', and 'rowCounter', which is useless if i'm forced to use Chars. any advice would be much APPRECIATED I'm having some DIFFICULTY making sense of your post. First, your title doesn't make sense. You SAY, "instead of Range("A1")", but A1 is not a valid range name; it is a cell address and all cell addresses are based on row and column. You can name a range and then use that range name in a formula instead of a cell address. Maybe that's what you're asking about. For this to work, I believe the range name would have to refer to a single cell, not a range of cells. |
|
52. |
Solve : Simple Dice roller C++? |
Answer» Hi all, srand ( time(NULL) );as Geek stated! Unless of course you want to try to trick people into thinking you can see the future and can predict what 7 numbers will come up next after start of program..lol |
|
53. |
Solve : C++ and rand issue with flexible random integer generator? |
Answer» Well I hit an interesting one here. Maybe someone can show me how to resolve this issue. All other TIMES I have ever used rand for random generator in the past its always been predetermined integer ranges such as %10 to have 0 thru 9 unless you +1 to have 1 thru 10. Well I want to SET the range as adjustable based on what A is equal to, and when testing this out I didnt expect an error, I expected it to be happy with it and compile, but from the error message it clearly is not. --------------------Configuration: Formula1 - Win32 Debug--------------------Found my problem.... typo in which A was actually declared in list of Doubles instead of in list of INTs.... All set now! |
|
54. |
Solve : actionscript 2, movieclip button? |
Answer» HELP me with this, i'm making a movieclip button that when mouse is over it will go to a different scene. on(rollOver){ gotoAndPlay("Gameover",1); } when i do that it's accessing the scenes inside the movieclip,PLEASE help me,i need to FINISH this tommorrow.it has been a very long time since I used Any ACTION script, but would you not need to use: Code: [Select]on(rollOver){ _root.gotoAndPlay("Gameover",1); } |
|
55. |
Solve : Automatically attach file to access record? |
Answer» Hello world, |
|
56. |
Solve : Custom auto filter code? |
Answer» Hi there. 'm creating a dynamic worksheet, and when you click a command button you have a list of filters to choose from Not really sure what your asking (some days I'm dumb as a brick ), but you can check if worksheets("name").autofiltermode is on and then use the .filters collection to cycle through the filters and place each one in a control for user selection. Quote from: Sidewinder on May 09, 2007, 03:47:54 PM Quote'm creating a dynamic worksheet, and when you click a command button you have a list of filters to choose from I tried this but It didn't work..... This is what I want. This is the code that filters the selected cells Selection.AutoFilter Field:=1, Criteria1:="Name" When you click the command button, it executes this code to filter the criteria you selected (from a drop down box). I have all the codes working for the different criteria, apart from the Custom auto filter box. I just wandered what code, would allow you to click the command button and open an custom auto filter box. Here is a picture just in case.... In an attempt to find this code, I found Selection.AutoFilter Field:=1, Criteria1:="=", Operator:=xlAnd but this does not allow the user to input their own selections.Thank you for clearing that up. At first I thought this would be simple enough to use the Application.Dialogs(xlDialog).Show method and then DISCOVERED there is no dialog for the Custom AutoFilter. Only other thing I can think of it to show the xlDialogFilter. If you can get a handle on the collection of selections, you'll notice the Custom AutoFilter is always third on the list. (index = 2) What exactly do I have to do then? put what code under my command button?I was unable to turn up anything from the Net, nor was Microsoft very helpful. Even my world famous snippet closet (IMHO) came up empty I guess in this case custom means do it yourself. Usually I find by doing something manually and recording a macro, that it produces the basis for more efficient self-written VBA code, but in this case the macro was empty except for some boilerplate comments. My suggestion would be to design a custom dialog and grab the parameters you need to setup the Selection.AutoFilter STATEMENT. Or you could just let the user choose custom from the autofilter list and fill in the dialog. Good luck. PS. For what it's worth, I did find there is a xlTop10Items constant. Well you see the thing is, (because of my assignment guidelines) the user sis not allowed to select anything from the cells/filter list, so it has to be done by other methods And I don't know what this means "My suggestion would be to design a custom dialog and grab the parameters"? One way I could do it is, have an input box appear and using a lot of variables and strings, adding them up and getting some sort of custom filter (perhaps difficult and a lot of bother)I guess if it were me, I'd design a form to duplicate the Custom AutoFilter dialog; show the form when the command button is clicked and use the data entered by the user to build the criteria1 and operator parameters of the Selection.AutoFilter instruction. If you record and edit a few macros using the built in Custom AutoFilter dialog, you'll see the relationships between the data entered in the dialog and where they end up on the selection statement. Both the VBA and the Excel help are great sources of information. As mentioned I was unable to find any information doing this with built in properties or methods. I'm currently using Excel 2002, so if you have a more recent model perhaps Microsoft addressed this issue. When you say assignment, are you referring to homework Quote from: Sidewinder on May 10, 2007, 03:12:53 PM I guess if it were me, I'd design a form to duplicate the Custom AutoFilter dialog; show the form when the command button is clicked and use the data entered by the user to build the criteria1 and operator parameters of the Selection.AutoFilter instruction. I will now. That is what I have been doing with most of them, creating macros then using autofilter options, than adapting it for my worksheet. Its just that recording the custom auto filter selection showed the code to be a bit more complicated, and I wanted to find the easiest way Quote When you say assignment, are you referring to homework Yes I am but don't worry I am well within limits. My assignment guidlines say I have to create the worksheets, not what happens in them, this is merely fixing an error. After all, I have done all of it myself, I can understand and apply it just this particular code ELUDES because excel does not give info on it.... Basically, here is a LITTLE inside into my code (if it helps) Basically, you select the filter option you want from the drop down box. Then click the command button which executes the code. Private sub [......] Range("B3:B15").Select If COMBOBOX = "Make" Then Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="Make" End If End sub And here is the code I got from the Macros of Custom auto filter ActiveWindow.SmallScroll Down:=-9 Selection.AutoFilter Field:=1, Criteria1:="=", Operator:=xlAnd But it is far to long for me to allow the user to do manually. |
|
57. |
Solve : omg i dont get this!!!? |
Answer» i have a few questions. So is visual basic and C++ 2 DIFERENT programing languages? visual basic is a program that actually uses visual basic programing LANGUAGE, but what program uses C++ programing language??? |
|
58. |
Solve : PLEASE, NEED 2 LEARN, HELP A NOOB, GET A NOOBS BLESSING, AMEN!i guess? |
Answer» ok ive tried programming be4, but the only problem is that i dont even know for sure what programming it. Not meaning to be offensive but there are TONS of posts on this one topic and some even on the first page of this topic. I suggest just reading through all the different topics and posts on the forum about programming. But iam a STUPID noob =( it would dmg my brain 2 read all this stuff, but ill try until some1 helps me out ......be4 i HELP myself outIt seems your brain is already too damaged seeing as you are too lazy to type "damage" and "before", abbreviations can be a beutiful thing but after a while they just become annoying.i cant help it, its like STUCK in my head.....on my brain, the big brain.........i hate that there is more then 1 brains , and as i said its like ........i dont know what iam saying, i need 2 sleep wow16Hours awake and ive got school in 4 H , so ill need 2 be up and take a shower after 2 H , 26-29 Hours that will be my high score, .......but still ill need 2 be up for 11-14 hours wish me luck , wow i hope i dont fall asleep in schoolNobody wants to do all your research for you. We'll help, but you have to show that you're motivated enough to actually begin. & it hlps f u spl evrtng out lik u wr tot N scl. You're at a computer, not a cellphone.I have two requests... shimal: See a physician as soon as possible. The mods: Make some kind of sticky for this topic? |
|
59. |
Solve : Pascal to Java?? |
Answer» I've been learning pascal for a little while now and learned the basics of the loops and how to sort. How FAR do I have to go in learning pascal before I'll be ready to take on Java? I tried learning Java from a book called Beginning Java 2 by Ivor Horton and I didn't understand a lot of what he was saying there, so I decided to give pascal a SHOT from then on.I've never used Pascal but the fundamental ideas of programming - conditional statements, loops, variables etc - are the same for almost all programming languages. So experiance with Pascal should help with Java generally. But I don't see any point in people learning one LANGUAGE in "preperation" for another. If you didn't like that book, try another or LOOK for tutorials online.Do you have any tutorials that you could suggest which helped you?I've not used Java myself, but I've used C++ which has some syntax simularities. |
|
60. |
Solve : Algorithms Am I on the right track?? |
Answer» I really want to understand this was wondering if I have the right idea as far as answering the questions so far. It seems to be so basic ~ for an example, I think if I input 55 the output would be both outputs: output "your grade is" 55 and output "you did OK", I know X represents the integer right? What language is this? An conceptual teaching language, maybe? I am not sure if it is a language, I am PRETTY new at this. So can someone tell me this..when would endif output "how did you do?" pop up? I mean if there is no room for error, or no error output, would that even be relevant? And is my answer of there being 4 nesting correct? Or is only one nest since all the info comes in between input X and endif? I am sorry, I am trying to understand. Thanks for your input.As I understand, you want to find where a scalper is in a range of values, then print a message for that range only. NORMALLY the variable is non the left and the constant t is on the right. Here is a similar solution. We make a block and break out of the block when we are in a range. Let invest a thing called "block" so we don't need the else if thing. Code: [Select]begin block if X < 50 { output "you fail" break } if X < 70 { output "your grade is" X output "you did OK" break } if X < 85 { output "your grade is" X output "you did well" break } if X < 100 { output "your grade is" X output "you did great" break } output "your grade is " X output "please report to the dean's office" end block output "end of report" I believe this is what you intend, but it is maybe not self-evident, But that is how programmers do things. It might be easier to understand if you made and object that tests for range and outputs a message. That is great, you have really assisted me in understanding this on a much better level. Thank you so much! Glad to help. Your problem can benefit from a CASE or SWITCH structure. Or you could create your own special function or procedure. You may like to read this: http://en.wikipedia.org/wiki/Switch_statement In some applications, maybe a network database, reducing the block to minimal code may be a critical issue to improve response time. Quote Optimized switchThis can be an interlinings area of study if you need to work with SQL or similar things.Geek, I don't think you realise what is going on here. I tried to give a hint, but you didn't take it up. I'll try to make it simple. 1. The OP, webdev57, is not seeking help to write some code. He or she is seeking help with a school or college assignment. 2. The assignment is to read a program, written in a pseudocode and answer questions about how it would work. 3. How it would work, that is, if it were a real programming language. 4. The pseudocode contains structures and logic found in programming languages. 5. That is what I meant about teaching language but it evidently passed you by. 6. The above is obvious from the format of the original post, in my opinion. Thank you Salmon Trout, Did not mean to do his homework for him. Quote from: Geek-9pm on September 03, 2011, 12:07:42 AM Thank you Salmon Trout, I think you were OK, he asked enough questions to show that he was thinking the project through, and he seemed to want confirmation that he was on the right track, as his title says. I just thought you were wasting your time re writing the code though. Helpful though that seems to have been. Quote from: Salmon Trout on September 03, 2011, 12:11:31 AM ...His code was hard to read. It was redundant and would never do inside of a loop. I just had to re write it. Quote from: Geek-9pm on September 03, 2011, 01:02:21 AM His code was hard to read. It was redundant and would never do inside of a loop. I just had to re write it. It wasn't "his" code; I am pretty sure of that, and I don't see why it shouldn't work within a loop. Why do you say that? Since it is in a yet-to-be-determined language, we cannot make assumptions like that. The code listed asks the user to input a number and then using conditional logic, do various things depending on the value of that number. The code is written in a kind of generic "does-not-actually-exist" programming language. The object of the exercise seems to be to evaluate the student's ability to read source code and deduce what it does, independent of any particular language implementation. Salmon Trout. You are very perceptive. I made the mistake of thinking he wrote it. I did not say it would not work. I was guessing that a compiler would not optimize it. i think this language must be visual basic right? ..oh how really miss studying its been 3 years since i last practice my programming skills fortunately i joined such forum thanks guys for some refresment |
|
61. |
Solve : Log file from batch file? |
Answer» I created this batch file (XP Cleanup.bat) to faster automate deleting temporary files. I CURRENTLY have the batch file logging the user, start, and end time of when it ran. I would like to have a more detailed log file. For example how many files from each location were deleted and the time to do it. I am not SURE that this is even possible. I found that USING the command (dir "%userprofile%\COOKIES" /b/s /a-d |find /v /c "::" >> Cleanup.txt) would GIVE me the number of cookies/files in the “Cookies” folder. When I try to create a variable with the command (dir "%userprofile%\cookies" /b/s /a-d |find /v /c "::" ) it errors. Can anyone help me? |
|
62. |
Solve : Script-Permanently Map Network Drives?? |
Answer» Good weekend EVERYBODY! |
|
63. |
Solve : Game programming language? |
Answer» If i was to learn to program computer games what language would you suggest i learn? It would preferably not be extremely complicated but would allow you to create 3d good looking games. So a language that will allow me to write a variety of games that people will like. If complication was not an issue what language would you suggest? ThanksUsually people make 3d games using Macromedia Flash or Game Maker or something.... |
|
64. |
Solve : IF Statement in C Language? |
Answer» Hi everybody |
|
65. |
Solve : C++ coding? |
Answer» I wrote this code and I am unable to compile and run it. Everytime I try and compile it, I'm always getting a lot of errors and I can't seem to figure out what is really wrong. I am using Microsoft Visual Studio C++ 2010 as my compiler. Also, I am trying to substitute out the logical equality operator "==" with "<=" and also ">=" just to see what HAPPENS. Here is the code... char sex;char sex[]; Quote cout<<Susan.number_of_children<<ENDL…cout< Quote };Thinking you need to define something as an object between the } and ; such as in the code on this linked page: http://msdn.microsoft.com/en-us/library/64973255(v=vs.80).aspx The compiler itself gives you a lot of useful information to help point out syntax errors. If you click on the line in the error log it will highlight the line where the issue is, however sometimes the compiler cant interpret what your intentions were and so you get an error that doesnt point to a single line which can get frustrating especially if your code all looks good and its a difference between one compilers format and another. This can happen if you are missing an #include or if your compiler requires the .h at the end of an #include as I found out long ago with Borland. Quote from: DaveLembke on September 12, 2011, 07:21:31 PM char sex[]; M or F would be a single character. Code: [Select]if (Susan == Mary) should be: Code: [Select]if (&Susan == &Mary) If you want to see if two object references are the same, you need to compare the addresses of the objects. using == will try to call the overloaded comparison operator, but your struct doesn't have one.I usually declare my Chars with char Tag[]; so that if by accident the user enters 2 or more characters such as "Male" it doesnt overflow, and my if statement following it would test the input to make sure it is M, F, m, or f and not FF etc, and if more than 1 character and if the character isnt 1 of 4 valid inputs state the error and request proper input. This input sequence would be nested in a loop whereas if the correct single character is input, the loop would be met and leave loop. But yes BC your correct in your statement that it was ok for a single character input. I should have commented on why I suggested that. Quote from: DaveLembke on September 14, 2011, 01:43:37 AM I usually declare my Chars with char Tag[]; so that if by accident the user enters 2 or more characters such as "Male" it doesnt overflow,It won't overflow. but it will fill the input buffer. the proper way to fix this in a C++ program would be to actually use C++, rather than C, constructs. In this case, strings: Code: [Select]#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { string inputline; for(;;) { string charinput; cout << "\nPlease input a letter: "; cin >> charinput; while (!isalpha(charinput[0])) { cout << "You have entered an invalid input, please input a letter: "; charinput.clear(); cin >> charinput; } transform(charinput.begin(), charinput.end(),charinput.begin(), ::toupper); cout << "first character was " << charinput[0] << endl; if(charinput[0]=='q' || charinput[0]=='Q') break; } return 0; } In this case one could just take the first character of the string. This would allow people to enter "FEMALE" or "Male" or "Man" or "Femme" or "Filly" or something crazy like that. Or, of course, one could at that point check for first character, but presumably the input prompt would make it clear what they should do. Quote and my if statement following it would test the input to make sure it is M, F, m, or f and not FF etc, and if more than 1 character and if the character isnt 1 of 4 valid inputs state the error and request proper input.There is of course one problem THOUGH, and that would be if they input characters past the number that you declared for the array. Also, in the example above, I just uppercase the entire string before checking the first character, so I would only need to check for M or F, and not m and f. I didn't mention any of this, since it had absolutely nothing to do with their issue. |
|
66. |
Solve : Advanced Startup question .bat? |
Answer» I made an arcade and set the winlogon shell to C:\hyperspin.exe. |
|
67. |
Solve : SQL Query involving 2 tables and average of multiple rows? |
Answer» Need a quick answer to this question, pls: |
|
68. |
Solve : Really bad case of fragmented files? |
Answer» Title tells you what this is about. When defragmented a vast amount of fragmeted files will not be defragmented. The computer hasn't been defragmented for years so there is about 90% of files are fragmented. We have tried to defragment multiple times but it does't make a difference. So what is the solution to this other then re-format? Is that other defragmenter on the computer or downloadable? Google for it, it's freeware. www.diskeeper.com Costs money, but as far as I know the best defragmenter on the planet. A reformat would SOLVE the problem, but is a bit drastic. How much free space do you have? If you have too little, you will not be able to defragment effectively. |
|
69. |
Solve : while loops? |
Answer» Hi, I'm trying to learn Java from a book i found at the local library, is this possible without actually having the software? And secondly, can anyone show me an example of a Java while loop using if and else?. The task I've set myself is to sort a pack of cards (20?) with only four different images, 2 squares shaded/plain , 2 circles shaded/plain.Any help would be appreciated. Regards Cat. Code: [Select]function BreakTest(BREAKPOINT){ var i = 0; while (i < 100) { if (i == breakpoint) break; i++; } return(i); } * courtesy Windows Scripting Technologies Quote I'm trying to learn Java from a book i found at the local library, is this possible without actually having the software It's EASIER if you have the software so you can follow along. I do not recommend this should you have an interest in learning to fly. |
|
70. |
Solve : i need Explanation for my C progrm? |
Answer» Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.. |
|
71. |
Solve : Verifying file stability using DOS command? |
Answer» I have flat TXT files SENT me and I need to verify if the file is stable or unchange before executing a BAT file !!! |
|
72. |
Solve : Paranoid Programming Language? |
Answer» The more I read, the more I am entertained. |
|
73. |
Solve : Re: For my fellow newbies? |
Answer» Hi , rain or anyone ELSE that would care to answer , I'm learning Ruby myself and having trouble with creating a program , the program must alphabetize any word typed and do a gets.chomp kinda thing. Thats the problem i cant get the hang of arays I'm trying to create the program so it takes the as many words as a person WANTS to TYPE and after presing enter and SORTS it alphabetically then when the enter button it sorts the word and if enter is pressed with out a word then the output is printed as a alphabetized list on the screen . if this is the wrong place to post this , im sorry . as far as i can figure it would look sorta like this . |
|
74. |
Solve : Backup up to different folders with batch file? |
Answer» I was given this example for scripting by Sidewinder: |
|
75. |
Solve : Net Logging batch? |
Answer» How would I be able to create a batch file to log the internet history of a USER withought getting, what I think are, encrypted folders; and having it RUN every TIME content is automatically added by wondows?why do you want to get internet history? There are programs to do that already.I need to randomly monitor some PC's withought having to run a full fledged PROGRAM and withought users getting suspicious due to tray icons, etc. |
|
76. |
Solve : Trouble learning to program? |
Answer» i tried learning a program also. i tried vb. then java. sad to say dat i really dono how to program. grrrr or may i'm just too d***. maybe my brain is stained already (sigh!). or maybe i need to learn word for word about DOS, since i just know basic DOS....grrrr....
No Python My own: Interpreted
No Python for me, either. I also know a couple program-specific interpreted "languages", such as writing events for the old Civilization II, and a couple other program-specific stuff, but they don't really count. *Yes, I know that JS is based on Java, based on C++. However, it's a heck of a lot easier to do "document.write()" than C++ will ever be. Quote from: javanesence on March 30, 2007, 05:05:25 PM just anything i can make, hopefully. depending on the program that i will learn in the future. right now, just concentrating on python. hope i can learn from this one w/o giving up.Python is very easy to learn. go to the official documentation site. Take the tutorial and browse through the site. If there's anything you are stuck, you can ask here (or other forum). I or the good ppl here will help if we can. You won't regret learning Python. Quote from: Dilbert on March 30, 2007, 05:55:52 PM *Yes, I know that JS is based on Java....On the contraryBASED on, ghostdog, not the same. Similar concepts, somewhat different syntax and very different implementation. I know. Just dont give up like that. I read a C++ book that was thin and basic, but it took me over a year to understand it. Heres some advice: If you like math, and are good at it, you will enjoy computorer programming. Think about it, Int I=100; Int H= 0 Int A=60 Int Math = I * H + A It would equal 60. Just like algabra. If you hate math, computor programming may not be for you. If anything ends up more STRESS than PLEASURE... you should find somthing else to do. I'm not saying you said quit, but im just saying Dont try to catch a train that isnt coming.... If you work hard, you can do anything....if you want to program bad enough you can do it im not going to be a cheerleader for ya but this may help .you dont know witch language you want to learn because you have no direction are you looking to program games make windows applications ? perhaps a.i. chater BOT to talk to there are only as many limitations as your motivation imagination and drive . Find what you enjoy doing on computers then find out what language it was written in if you arn't enjoying the jorney to programing then you could be traveling the wrong path .but my best wishes to you .you can do it if you are motivated and want it enough. |
|
77. |
Solve : From PHP to Windows Apps? |
Answer» My background is web based programing predominately PHP/MySQL. I currently find myself working on a project that I would like to CONVERT to a windows based application. There is really no need other than to give a user a choice of what type of application they use. The things I need to be able to accomplish are: |
|
78. |
Solve : C++ Console App text display refresh question? |
Answer» When running a C++ program that displays for example the prior text and then a cartwheel with a percentage of complete for an installer, what method do people use to show the ascii text transition so that the prior text above it doesnt have to be refreshed. Currently I have a loop that displays the static text above it with a progress bar and the progress bar I have a cartwheel by use of stepping "/" then "-" then "\ "then "|" and repeat with a percentage to the right of it to show the progress, and the cartwheel pauses and continues when it reaches portions that take longer to process. The text above it flickers with each transition since it is reprinted to display after a system("cls"); routine, since otherwise you will have it scroll down each transition. \c (I believe( is carriage return (ASCII character 13) new line is \n carriage return is \r Think of a teletype machine with a carriage that can move LEFT and right (that holds the paper which is wrapped around a roller) and a fixed print head. Carriage return moves the carriage back (returns it) so the print head is over the leftmost character position. Newline returns the carriage and then moves the roller one lines worth of rotation "upwards" so that the print head is over the next line. Thanks for describing it like a teletype. That visual helped me better understand the \r At one time a teletype was the usual output device for computers, and later on you got a type of CRT + keyboard terminal sometimes nicknamed a "glass teletype". In many ways text output to the console is still based on teletype concepts. Thanks for the HELP. Below is a quick test of it in action. Works Awesome! I guess I was spoiled to never have to use a teletype. When I dove into computers in 1983 I had a monochrome display with Basic. The closest thing to a teletype was the dot matrix printer printing out my listed code or printing out fake Point of Sale transactions for school projects like the Grand Onion that I remember the teacher having us create a spoof of Grand Union Food Store. Code: [Select]//Testing \r with pretend installer #include<iostream> using namespace std; int a,b,x,i=0; int main(){ cout<<"Installation Simulation - using Slash R\n"; cout<<"=========================================\n"; while(i<=15){ //increment while loop counter placed here to change from 0 to 1 prior to loop i++; //Return and Display progress if(i==1){ cout<<"\r"<<"* [ 5% ]"; } //For delay placed here so that no delay on first display of 5% //For delay used so that you can see transition of STEPS vs only displaying last print //Very large number because fast computer can crunch out the 10 million calculations of b=a //quickly for(x=1;x<=100000000;x++){ b=a; } if(i==2){ cout<<"\r"<<"** [ 10% ]"; } if(i==3){ cout<<"\r"<<"*** [ 15% ]"; } if(i==4){ cout<<"\r"<<"**** [ 20% ]"; } if(i==5){ cout<<"\r"<<"***** [ 25% ]"; } if(i==6){ cout<<"\r"<<"****** [ 30% ]"; } if(i==7){ cout<<"\r"<<"******* [ 35% ]"; } if(i==8){ cout<<"\r"<<"********* [ 42% ]"; } if(i==9){ cout<<"\r"<<"********** [ 50% ]"; } if(i==10){ cout<<"\r"<<"*********** [ 55% ]"; } if(i==11){ cout<<"\r"<<"************ [ 60% ]"; } if(i==12){ cout<<"\r"<<"************* [ 67% ]"; } if(i==13){ cout<<"\r"<<"************** [ 75% ]"; } if(i==14){ cout<<"\r"<<"*************** [ 88% ]"; } if(i==15){ cout<<"\r"<<"**************** [ 100% ]\n"; } } cout<<"\n\n\n"<<"Simulated Installation Complete\n\n"; system("pause"); return(0); }Actually have another question as well since playing with the \r. It seems that if I have a statement in an COUT asking for user input in a CIN, I cant find a way to make the COUT display the first question and user input as keyed and then clear that last question for a clean screen for the next user input unless I scroll the screen with a bunch of \n's. I was hoping I could double up on the \r's and have it clear out the prior line which was the COUT information in addition to the user input as displayed. Currently the text displayed and user inputs unless I scroll with a bunch of \n's shows like this Enter Integer # 1 3 Enter Integer # 2 5 Enter Integer # 3 8 The sum of your input integers = 16 Is there a way to clear without using system("cls"); and without scroling with cout<<"\n\n\n\n\n\n\n\n\n\n"; so you see the first input question and then upon entering your answer it clears up 2 lines to overlay fresh information in the place of the prior question. All other text displayed above it uneffected since you dont have to clear screen or scroll to remove the prior question? There is no way to atomically clear the screen in C++; some libs seem to have a clrscr() function, but I keep getting unresolved externals when I try. The REASON is C/C++ don't know that the standard input and output are really something that can be cleared. For example, consider the case where the output is being piped to a file- what should clearing the output device do? Really, the only option is what you stated- a set of consecutive linefeeds.Thanks BC! Figured I'd check in case there was a better way. Guess I will stick with the consecutive line feeds since I try to avoid system("cls"); |
|
79. |
Solve : insert image file in c? |
Answer» how can i insert a IMAGE FILE IN C PROGRAMMING PLEASE SEND ME THE PROGRAMMING....../?? how can i insert a IMAGE FILE IN C PROGRAMMING PLEASE SEND ME THE PROGRAMMING....../?? Code: [Select]INT main(char*[] ARGV, int argc) { //left as exercise for reader } |
|
80. |
Solve : Connect VBapplication to Access database? |
Answer» Hello. You might also write a simple program to open a database (Access 2003), execute a sql select statement, and display the results. Keep it simple by not binding the database to a control and see if you have any problems. How would I go about doing this? I'm only an amateur so I don't know, I know how code works and how to apply it, I'm just not sure of the specific code to do this as Ive only connected it to a database through the properties. Note: My Visual basic 6.0 and Microsoft Office 2003 (programs only) are free software that I get from Microsoft because I am a student at college...If that explains anything about the versions...There is a service pack AVAILABLE for VB6 available >here<. I can't remember what it updates but it may help with your problems.Actually the above download if for the VB6 runtime only. The full download can be found at VB SP6 and it is quite large. You might also give this a read as this may apply: PRB Error Your best bet is still to upgrade VB to SP6. Good luck. Well I downloaded the Service pack 6 but I'm not sure where to extract the files to. I extracted the files to Microsoft Visual studio folder in then program files but it appeared to have no affect and I still got the error message. The instructions were on the same page as the download: Quote Instructions You also mention Visual Studio. You can upgrade the studio programs with the update located at Visual Studio SP6 I may have forgotten to mention that in your project you will need to create a reference to Microsoft ACTIVEX Data OBJECTS 2.8 Library and Microsoft ActiveX Data Objects Recordset 2.8 Library. You do this from the Project drop-down menu. Good luck. Yes but the instruction where not fully specific. I ran the install and it does not install the files for you, it asks you to choose a directory with the files in, in which to extract to, so I extracted them to the Visual studio folder in Program files. But Visual Basic 6.0 is part of the Visual studios package... Could you tell me the folder I should extract the files too? it should be program files right?After the download, run the file just downloaded: VB6SP6B. This unpack the file into a set of component files. (You can use the same directory you used for the download) Then run the setupSP6 application file to do the actual update. After you accept the EULA, the update will run. When complete, open up VB and check Help==>About which should now mention that SP6 was applied. Hopefully this should fix your problem. If not please post back with the exact error message you get. *censored* when I click setupSP6 I get an error message. I have made a picture of the error message. Click hereI've got to remember to ask the basic questions in the beginning, but what OS are you running? There are two setupsp6 files in the package. One has a lst extension, the other a exe extension. You need to double click the exe file from within Windows Explorer. Do not try to run the setup file from the cmd or command environment. What update did you finally decide on, Visual Studio SP6 or Visual Basic SP6? |
|
81. |
Solve : Easy one (probably)? |
Answer» Okay I know pretty MUCH zero about vbs just to give you some background. I found this code on another forum and it does pretty much exactly what I need except for it echos the hostname of a pc in a pop-up box. I need it to write a line (this is going inside an HTA file). Here's the code: |
|
82. |
Solve : delphi cdrom? |
Answer» I am a beginner with delphi and i need somme help.I need a procedure to detect my FIRST cdrom DRIVE , SOMETHING to CHECK if EXISTS a unique file to a specific location . |
|
83. |
Solve : Batch Log file check points? |
Answer» I have created a log file that will automatically backup by overwriting. How would I enhance it to backup up for five days, (Mon-Sat) and then, depending on the day it was executed, automatically backup to that specific folder? Depending on your OS something like this may work:No, it depends on your time layout/format. For example (win xp): 1. Go to Control Panel 2. Open Regional and Language settings 3. On the Regional Options tab, click Customize 4. Click on the Time tab 5. there is a 'time format' drop down menu. If that changes, so will what time say in Command Prompt. |
|
84. |
Solve : For my fellow newbies? |
Answer» These sites along with this one have been very helpfulin my quest to learn to program with out actually GOING to school for it. |
|
85. |
Solve : Help needed in making a program or any batch file? |
Answer» HI All, I am new to making C or C++ programs. Situation is that we have a word file of 7 lacs rows. In the file, simple commands of dropping indexes and then recreating them again is there. Most of the indexes are getting recreated. I need to find such indexes which are getting dropped but not getting recreated. sample of the concerned word file is as follows - --------------------------------------------------------- DROP INDEX DATABASE.PS_SCON_ATT_LNG ; COMMIT ; CREATE UNIQUE INDEX DATABASE.PS_SCON_ATT_LNG ON PFPRGP.PS_SCON_ATT_LNG (SETID, CNTRCT_ID, LINE_NBR, SCHED_LINE_NBR, FILE_EXTENSION, DOCUMENT, LANGUAGE_CD) USING STOGROUP PRDGROUP PRIQTY 48 SECQTY 720 CLUSTER BUFFERPOOL BP2 CLOSE NO ; COMMIT ; DROP INDEX DATABASE.PS_SCON_COMPTTRS ; COMMIT ; CREATE INDEX DATABASE.PS_SCON_COMPTTRS ON PFPRGP.PS_SCON_COMPTTRS (SETID, CNTRCT_ID, LINE_NBR, SCHED_LINE_NBR, COMPETITOR_CD) USING STOGROUP PRDGROUP PRIQTY 48 SECQTY 720 CLUSTER BUFFERPOOL BP2 CLOSE NO ; COMMIT ; DROP INDEX DATABASE.PSASCON_CUST_CGRP ; DROP INDEX DATABASE.PS_SCON_CUST_CGRP ; COMMIT ; CREATE UNIQUE INDEX DATABASE.PS_SCON_CUST_CGRP ON PFPRGP.PS_SCON_CUST_CGRP (SETID, CNTRCT_ID, SOLD_TO_CUST_ID, CUSTOMER_GROUP) USING STOGROUP PRDGROUP PRIQTY 48 SECQTY 720 CLUSTER BUFFERPOOL BP2 CLOSE NO ; CREATE INDEX DATABASE.PSASCON_CUST_CGRP ON PFPRGP.PS_SCON_CUST_CGRP (SETID, SOLD_TO_CUST_ID) USING STOGROUP PRDGROUP PRIQTY 48 SECQTY 720 BUFFERPOOL BP2 CLOSE NO ; COMMIT ; ------------------------------------------------------------------------------------------------- Can anyone help me with any program or BATCH file which can find such indexes which are getting dropped and not getting recreated Or any way to create such batch file ?? Kindly help... Thanks in advance. Anshu.There is a REPLY to this question on the DOS board. Please do not double post, it causes much confusion and gets the natives very restless. |
|
86. |
Solve : Is WScript,vbscript, and cscript hybrid type's of BATCH???? |
Answer» Was checking out some lead's and found some stuff about making "SCRIPT"! |
|
87. |
Solve : MAPI SEND MAIL QUERY? |
Answer» Hi All , |
|
88. |
Solve : Comparing Date Values between Excel and Access (ADO)? |
Answer» Is there a simple way to MAKE identical the date format between EXCEL and Access ... i'm assuming there must be, but I can't seem to figure it out. dteTo is a Short-Date formatted cell in Excel I'm pretty sure the datatypes are mismatched and that by using the text property, something got messed up. Try using dteTo = Range("D28").Value You might try using Range("D28").Value directly in the DateDiff function or as a last resort using the CDate function to guarantee all the FIELDS are converted to dates. Good luck. PS. VB and VBA are not very forgiving when it comes to mismatched datatypes. |
|
89. |
Solve : Class Vs Structure in CPP? |
Answer» It is said dat class and structure are same in CPP. But, does structure can also have ABSTRACTION, encapsulation, inheritance, polymorphism as well... (please NOTIFY if any notion about union and enum in this)... The DIFFERENCE is that members of a class are private by default, but members of a STRUCT are public by default. inheritance between classes is private by default, and inheritance between STRUCTS is public. |
|
90. |
Solve : Calling an application in ASP2.0 using c++ and other things? |
Answer» How would I run an APPLICATION in an asp2.0 page using C++ as the code behind TYPE such as ipconfig? |
|
91. |
Solve : C++ fork() function? |
Answer» I'd like to be able to do a fork() as an exercise for future reference if I need it. Examples on the internet have it similar to this: |
|
92. |
Solve : Escape game -- new thread? |
Answer» New programming methods; new thread warranted. Sample comment; nothing outside of header tags are used. Output: Welcome to Escape by Timothy Bennett. The object of this game is to escape my house. This is debugging filler to test the file parser. It's up and running! I can safely say I've never written a for loop that way before. With the file parser down, it's time to work on the command parser. The command parser will make figuring out the file parser look easy. The problem isn't so much writing the code as figuring out the best way. In earlier attempts at this program, the room-specific commands were functions inside of the class the room was in. This made it easy to write a command function as I had direct access to the variables I needed to access. No accessor functions, no "returning a reference to an object" so I can manipulate a variable. However, this may not be technically feasible anymore. Three instances will use the same class, SmallBedroom, so using that method I'd have to put the commands for timsBedroom in the same spot as sarahsBedroom in the same spot as -- well, you get the idea. I don't want to do that, because not only does that place undue importance on the enumerated ROOM, but it's unorganized. The other strategy, which I'm starting to like more and more, is to put all parsers and command functions in a Command class. Public will contain the parsers; private will be the commands. That's a lot of functions for one class, but then it's out of the way.Cool. I am reading your posts but I've been too busy to make a decent reply to them. How exactly are these commands going to work? I was thinking of something like the following, but more complicated. Create a dynamic number of event/scene classes containing an id number, a string for the description of the area, and a dynamic number of choices with a string for each choice and the destination id. Each event stored in the script has an id number, string description and a number of choices and destinations. For example, choice 2 is "go in second door" and leads to event id 7 (that room) or you could name each scene if that's more convienient. That's a simplification of the way I would do it. Is this similar to the way you are planning to do it?If the house in question were large, I'd do something very close to that. (Or maybe I am; I didn't follow you 100%.) If you were saying that the user pick from a menu of available options, then that is something I would gladly do if this game were much larger. As it is, it's not very large(!), so it's going to be somewhat of a throwback to the old command-line games, where the user enters a string of text, such as "take item". An example of an online form of this game style can be seen here: http://thcnet.net/zork/ Of course, this requires a good deal of creativity on my part, making sure the parser accepts multiple variants of the same command. Even better, they could be in a file, allowing them to be edited without having to recompile the program. It's a matter of how much of the game I want to expose for editing. This, I feel, can be done. Again, I wouldn't do this if there was any real difficulty in the game itself. It may have a few points, but I don't think so. (Then again, I'm writing this game and know exactly how to win. )Update: Class-work for the first room is complete. File parser is complete; I'm working on the command parser. I'm noticing the downside of OOP. This game needs OOP, but how often can I type things like this and remain sane? if(timsBedroom->getComputerDesk()->getLight()->inInventory == false) { timsBedroom->getComputerDesk()->getLight()->inInventory == true; parseFile("#TAKE_LIGHT", "#END_TAKE_LIGHT", 1.5); //Delay getline for 1.5 seconds } As you can see, I'm using pointers for all my classes so I can delete them and set them to 0 as needed (each SmallBedroom instance has different classes, so this is required), but that means I'm eternally calling functions that return pointers to classes. TO-DO LIST: Finish first room 1. Write command parsers 2. Write command functions 3. Write dialog I'll worry about the rest of the game later. Try macros. #define location timsBedroom->getComputerDesk()->getLight()->inInventory I'm not sure if you can redefine marcos but if you can then just redefine location at the start of each section withs lots of repetitive object names. You could even combine them. #define area timsBedroom->getComputerDesk() #define subarea getLight() area->subarea->inInventory #define subarea getBook() area->subarea->inInventory |
|
93. |
Solve : Exceptions? |
Answer» Does anybody know where I can find a list of exceptions included naturally in C++? I know OutOfMemory is one of them. I've been looking on the net for a while now. * std::bad_alloc - thrown by the new operator when memory allocation fails. |
|
94. |
Solve : I need to learn how to write C and C++ code!? |
Answer» :-? |
|
95. |
Solve : Q: Is DOS or Pyton able to handle IO com?? |
Answer» Hi, |
|
96. |
Solve : Batch File help getting drive letter? |
Answer» I need help trying to get just the Drive letter in batch files. |
|
97. |
Solve : CSript idea.? |
Answer» Dear All !! |
|
98. |
Solve : PLEASE HELP ME SOMEONE? |
Answer» hello my name is Cleo, |
|
99. |
Solve : copied ntfs.sys now pc wont boot to desktop?? |
Answer» I had a FILE missing a ntfs.sys so i put in my xp CD and copied it. when i was finished i took the cd out and exited and it REBOOTED. but i NOTICED that it had service pack 1 on there now not 2 and it wont go to DESKTOP but instead it keeps asking what mode i want to start windows in. I tried safe mode and normal mode and it still wont go to desktop. can someone plz help me? |
|
100. |
Solve : Plz Help on CD Protection? |
Answer» Hi All Hi All? |
|