Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~40.2K People Reached
Favorite Tags
Member Avatar for sgw

When I try to display the address of a char type variable, I don't get the normal hexidecimal address, but some strange symbols. I don't have the same problem with int or string, etc.. Example: char x='#'; cout << &x; The output of this is: #( ( What's the explanation?

Member Avatar for sgw
0
506
Member Avatar for sgw

Why doesn't the code (2) below produce the same output as the code (1)? Let's say you entered "4" as input: (1) int x; cout << "enter integer: "; cin >> x; cout << x++; cout << ++x; cout << x; The output of the above is "**466**" (as expected). …

Member Avatar for sgw
0
571
Member Avatar for sgw

The following is a similar program I had when having trouble: float x; int n=0; cout << "enter some numbers separated by space; enter 1.2 when done: "; cin >> x; while (x!=1.2) { n++; cin >> x; } The problem is, when using certain numbers as the sentinel (in …

Member Avatar for Suzie999
0
293
Member Avatar for sgw

The number D computed by the following polynomial formula D=(pow(i,5.)/120)-(pow(i,4.)/12)+(23*pow(i,3.)/24)-(83*i*i/12)+(571*i/30) should always be an integer, when i=1,2,3,4,5,.... However, for some i values, each separate term may not be an integer, but when putting together (with additions and subtractions) in the above formula, any non-integer parts would be "cancelled out", and …

Member Avatar for sgw
0
159
Member Avatar for sgw

In the following program I declared "long" for a, but still getting incorrect negative output after the 1860th term (all are supposed to be positive). What is the cause? int main() { for (int i=1; i<=2000; i++) { long a=i*i*i/2-3*i*i/2+3*i-1; cout << setw(3) << i << "\t" << setw(8) << …

Member Avatar for asifalizaman
0
254
Member Avatar for Azurea

I've read that one should use cin.get() instead of system("pause"). Why is that?

Member Avatar for WaltP
0
607
Member Avatar for sgw

Is anyone here familiar with RoboCup? Does it belong to gaming or something else? Where can I see an actual program example for it? What kind of langauge does it use? Thx.

0
61
Member Avatar for sgw

Hi all, this must be a very basic question... I want to embed a short video clip in a webpage. I want it to automatically start playing when the page is opened, and loop indefinitely (repeating itself over and over automatically). In the html script I did use [CODE] <embed …

Member Avatar for sgw
0
49
Member Avatar for sgw

What is the difference between these two types of assingment? (a) [CODE]string color("red"); [/CODE] (b) [CODE]string color="red";[/CODE]

Member Avatar for arkoenig
0
122
Member Avatar for sgw

Something that puzzles me in the following simple program: [CODE] #include <iostream> using namespace std; int main() { int row; cout << "enter row: "; cin >> row; int K[row], m[row][5]; cout << "Enter all the " << row << " K values:\n"; for (int i=0;i<row;i++) cin >> K[i]; cin.ignore(10,'\n'); …

Member Avatar for burcin erek
0
177
Member Avatar for sgw

Here is the simplest program: [CODE]#include <iostream> using namespace std; int main() { cout << "hello" << endl; cin.get(); return 0; }[/CODE] When I ran it (using Dev C++), there is no output, just a blank screen. The problem seems to be from the "endl". If I delete it, or …

Member Avatar for ppl154
0
139
Member Avatar for sgw

I just saw someone's program that assigned string this way: [CODE]string x("snow");[/CODE] It seems to work, as I could display the output x as "snow". Is this a legible way to assign strings? How does it differ from [CODE]string x="snow";[/CODE] ?

Member Avatar for Fbody
0
182
Member Avatar for sgw

In the following very simple program, if the input is [I]not [/I]an integer (e.g. a character symbol), then the output screen would flash and go away. Is there a way to have the output "bad" when one enters a non-integer, just as when one enters a negative number? Thanks in …

Member Avatar for sgw
0
249
Member Avatar for sgw

I ran the following simple program [B]10 minutes ago and it worked as expected[/B], i.e. it took input "monster" which contained spaces. [B]But few minutes later[/B] I copied the program exactly the same to save as a new program, and [B]it doesn't take the spaces in "monster" input any more[/B]--if …

Member Avatar for mvmalderen
0
168
Member Avatar for sgw

Hi everyone. I have a layman's question about the search results from google (or other search engines, for that matter): Sometimes when you search someone's name, let's say "John Doe", it brings out a result which turns out to be the [U]search result of a certain database[/U], such as address …

Member Avatar for Dani
0
148
Member Avatar for sgw

A question/curiosity: When using the time function, why must the argument be 0, as "time(0)"? I tried other numbers and it gave error.

Member Avatar for ArkM
0
23K
Member Avatar for sgw

I wrote [CODE]<embed src="mysound.mp3" controls="smallconsole" autostart="true" loop=3>[/CODE] The "loop=3" never workes. It always plays just once. Replacing "loop=3" by "playcount=3" makes no difference. This is the same whether using IE or FireFox. What's the cause? How to play it 3 times (i.e. more than once, but not infinite times)?

Member Avatar for MidiMagic
0
87
Member Avatar for sgw

When there are several cout statements, if the first cout statement has, say, << fixed << showpoint << setprecision(4), then all the subsequent cout statements *without* these settings will also have that effect. For example, in the following program, [CODE]cout << "sin(" << angle << ") = " << fixed …

Member Avatar for sgw
0
13K
Member Avatar for sgw

Sometimes when I use a lab PC for visual C++, even when a program is very simple and absolutely correct, and sometimes passes the compiler, but when i try to run it, it shows "Fatal error... can't find path...." what's the reason?

Member Avatar for mitrmkar
0
107
Member Avatar for sgw

Hi, Let's say x=12.34, y=567.89, z=6.38, and we want the output this way: _____$12.34 ____$567.89 ______$6.38 [COLOR="Red"]right-aligned[/COLOR] [COLOR="Green"]with the decimal point lined up[/COLOR] (where the ___ are [I]spaces[/I]) In other words, [U]all[/U] the numbers are right-aligned [U]and[/U] [I]immediately[/I] following "$". How to do that if you don't know what values …

Member Avatar for sgw
0
128
Member Avatar for sgw

Hi, If I want to print several numbers, say 12.3, 24.038, 154.9181, 0.4778--anyway, just all kinds of numbers, how can I print all of them with [U]fixed number of decimals[/U], say two decimals, that is, the output will be: 12.30, 24.03, 154.91, 0.47... ? The "setprecision(...)" doesn't work because it …

Member Avatar for jesseb07
0
116
Member Avatar for sgw

In the following simple program, [CODE]int main() { string name; char sex; cout << "enter M or F: "; cin.get(sex); cout << "enter name: "; [B]getline(cin, name);[/B] cout << name << " is " << sex << endl; return 0; }[/CODE] after the user typed in a character "M" or …

Member Avatar for Narue
0
252
Member Avatar for sgw

Hi, I'm trying to use the pow function. Extremely simple program like the following, but it never passed compiler: #include <iostream> #include <cmath> int main() { int a, b, c; a=2; b=3; [COLOR="Red"]c=pow(a, b);[/COLOR] cout << c; return 0; } Compiler would highlight the red part. What's wrong?:icon_rolleyes: Thanks in …

Member Avatar for sgw
0
613
Member Avatar for sgw

I'm completely new to using compilers such as Borland Turbo C++ or MS Visual C++ to create and run C++ programs. They both involve "form" and "projects". Could some kind folks tell me how exactly to create, compile and run a simple program in such environments? In other words, I …

Member Avatar for sgw
0
119