Forum: C++ Mar 7th, 2008 |
| Replies: 17 Views: 1,853 here's a way you can do this:
int x=1;
cout<<"Squares of numbers between 1-10"<<endl<<endl;
while(x<=10)
{
cout<<"Square of "<<x<<" is "<<x*x<<endl;
x++;
} |
Forum: C++ Mar 3rd, 2008 |
| Replies: 5 Views: 516 since you do know that only 5 random numbers will be the input
try using arrays after declaring float num1,num2...num5
then have something like
float numbers[5];
float temp1;... |
Forum: C++ Mar 3rd, 2008 |
| Replies: 4 Views: 1,443 try removing fixed and showpoint
cout << "sin(" << angle << ") = "
<< setprecision(4) << sin(angle) << endl;
cout << angle; |
Forum: C++ Mar 2nd, 2008 |
| Replies: 5 Views: 955 assignments should be done like this:
difference = amount_purchased-amount_payed; |
Forum: C++ Mar 2nd, 2008 |
| Replies: 7 Views: 1,031 row - selectedX = 2;
first off,you're lacking an equal sign if you are trying to compare values
that part is having an error because you used the assignment(=) operator
assignments should be... |
Forum: C++ Mar 2nd, 2008 |
| Replies: 4 Views: 685 one more thing
if you were asked to validate the input yearly gross
have something like this:
do{
printf("Enter your yearly gross salary :");
scanf ("%d",&yearlygross);
}while... |
Forum: C++ Mar 2nd, 2008 |
| Replies: 4 Views: 685 that should be
netincome=(yearlygross-totaldeduction)/12; |
Forum: C++ Mar 2nd, 2008 |
| Replies: 6 Views: 4,084 this one works for me:
cout<<"Enter number of grade input: ";
cin>>numgrade;
for (int x=0;x<numgrade;x++)
{
cout<<"Enter a grade in letter format: ";
... |
Forum: C++ Mar 2nd, 2008 |
| Replies: 16 Views: 1,453 oh yeah,i was actually using gets()
i just typed that code here
here's my actual code
cout<<"Input date:";
gets(date);
if (strncmp(date,"xxx xx xxxx",11)!=0) |
Forum: C++ Mar 1st, 2008 |
| Replies: 16 Views: 1,453 char one[10];
char two[10];
int n;
cin>>one>>two;
for (n=0;n<11;n++)
{
if (strncmp(one[n],"xxxx xxxx",10)!=0 && strncmp(two[n],"x,xx xxx.",10)!=0)
cout<<"Mismatch"; |
Forum: C++ Mar 1st, 2008 |
| Replies: 16 Views: 1,453 no that wasn't actually quick
took me almost 5 hours,mostly searching the net
it does not yet save/load from a file
but it's ok since it's only for school and alot has been applied in my prog... |
Forum: C++ Mar 1st, 2008 |
| Replies: 16 Views: 1,453 nevermind,i finished the prog.
to mods :
requesting for closure of this thread,thanks. |
Forum: C++ Mar 1st, 2008 |
| Replies: 16 Views: 1,453 how can i output a character underlined? or set to bold face?
searched the net but i can't find anything about it |
Forum: C++ Mar 1st, 2008 |
| Replies: 16 Views: 1,453 thanks for giving me an idea on where to start. |
Forum: C++ Mar 1st, 2008 |
| Replies: 16 Views: 1,453 lol
you said
anything doesn't mean everything.
though not really much,i still know something in c++ |
Forum: C++ Mar 1st, 2008 |
| Replies: 16 Views: 1,453 well,it's safe to say that i'm not that someone. |
Forum: C++ Mar 1st, 2008 |
| Replies: 16 Views: 1,453 i'm planning on creating a program for reservations (ex. rooms)
by analyzing my problem,the things i don't know how to are:
validating the date and whether the room inquired is available or... |
Forum: C++ Feb 25th, 2008 |
| Replies: 9 Views: 898 don't forget to put semicolons after statements
anyway,
for the additional $15 if balance is < $400
if (begbal<400)
total_bank_fees += 15;
equation for check fees: |
Forum: C++ Feb 23rd, 2008 |
| Replies: 6 Views: 698 are you referring to the length of the string?
strlen |
Forum: C++ Feb 21st, 2008 |
| Replies: 3 Views: 515 tot_cost=pprice*quantity;
if (quantity >= 10 && quantity <= 19) {
discount = tot_cost * .2; /*percent to decimal conversion: 20%/100% = .2*/
discounted_cost = tot_cost - discount; } |
Forum: C++ Feb 18th, 2008 |
| Replies: 17 Views: 1,409 ughh
took me 2 hours to fix it myself
but finally i got it working
anyway
thanks alot,DangerDev
i now have ideas on arrays |
Forum: C++ Feb 18th, 2008 |
| Replies: 17 Views: 1,409 i have a problem not related with arrays but decided to ask in this same thread anyway
because i think this question is not worthy of a new thread.
sorry for this mess but i think pasting here my... |
Forum: C++ Feb 18th, 2008 |
| Replies: 17 Views: 1,409 ahhh i got it!!!!
cout<<"Items bought:\n\n";
for (;n!=0;n--)
cout<<items[n]<<endl; |
Forum: C++ Feb 18th, 2008 |
| Replies: 17 Views: 1,409 yeah there's a switch before that
i didn't notice i included the case '1'
anyway
for(;parts!='x';n++) {
cout<<"Parts\n\n0 - quadcore\n1 - dual core";
... |
Forum: C++ Feb 18th, 2008 |
| Replies: 17 Views: 1,409 yes
case '1':
for(int n=0;parts!='x';n++) {
cout<<"Parts\n\n0 - quadcore\n1 - dual core";
parts = getch();
... |
Forum: C++ Feb 18th, 2008 |
| Replies: 17 Views: 1,409 const int max_items=100;
string items[max_items];
parts_page:
cout<<"Parts\n\n0 - quadcore\n1 - dual core";
parts = getch();
... |
Forum: C++ Feb 17th, 2008 |
| Replies: 17 Views: 1,409 yes,that's what i thought,that arrays would do the trick
but the problem is i can't understand clearly how to use arrays. mind showing me how?it would be greatly appreciated.
in my case... |
Forum: C++ Feb 17th, 2008 |
| Replies: 17 Views: 1,409 the user can buy as much items as he wants
then items bought be displayed after he's done choosing
that's the part i'm having a problem because the number of items being purchased depends on... |
Forum: C++ Feb 17th, 2008 |
| Replies: 17 Views: 1,409 char item_purchased1;
char item_purchased2;
char item_purchased3;
//and so on...
//then
parts = getch();
switch (parts) {
case '0': |
Forum: C++ Feb 17th, 2008 |
| Replies: 17 Views: 1,409 maybe what i need with this program are not arrays
someone who know some other way on how i can produce the output i want? |
Forum: C++ Feb 17th, 2008 |
| Replies: 17 Views: 1,409 this would be my first time with arrays so i still have no idea how to use it
i'm thinking on using it on this program
#include <iostream>
#include <conio.h>
#include <string.h>
using... |
Forum: C++ Feb 4th, 2008 |
| Replies: 5 Views: 691 oh,was that BEFORE the getline?
well,go with what works.
although the fflush is not preferred gurus
try to do the right thing
see how HERE (http://www.daniweb.com/forums/thread90228.html) |
Forum: C++ Feb 4th, 2008 |
| Replies: 16 Views: 2,493 Dev-C++ (http://www.bloodshed.net/devcpp.html) for me.
you might want to try MS visualC++ 2008 express (http://www.microsoft.com/express/vc/)
haven't tried it yet though. |
Forum: C++ Feb 3rd, 2008 |
| Replies: 5 Views: 691 what do you mean in this part?
the "please enter date" and "title" appears at the same time??
try using fflush(stdin); <<after the getline part. |
Forum: C++ Feb 3rd, 2008 |
| Replies: 12 Views: 3,303 pause() is a self defined function made by duoas
but i think a plain cin.ignore() works fine
or maybe it's just me on my compiler though |
Forum: C++ Feb 2nd, 2008 |
| Replies: 12 Views: 3,303 here at home i'm using dev c++ and i do get the same "problem"
i use system("pause") which i think is not preferred by others,but it's just me using it to see the output
then i just remove it... |
Forum: C++ Feb 1st, 2008 |
| Replies: 14 Views: 6,109 i did read.
what i'm asking exactly is when i declared globally:
using std::cin;
using std::cout;
the one's i'm using in statements would be |
Forum: C++ Feb 1st, 2008 |
| Replies: 14 Views: 6,109 i was about to ask this question too
so what's the proper way?
i always do declare globally this one
using namespace std;
should i just declare this one globally instead (if i'm using it) |
Forum: C++ Feb 1st, 2008 |
| Replies: 5 Views: 1,026 just an off-topic thought though
shouldn't the century be 20? |
Forum: C++ Feb 1st, 2008 |
| Replies: 19 Views: 6,481 since i do not have any knowledge yet about these pointers,i want to ask questions
i don't have my source code with me now because i did that at school
i did something like this:
char* color;... |