- Raymond
// Loops #include <iostream> using namespace std; int main() { //While loops. You put the condition in () just like if statements double BTC = 5857.468; // <<< this is the starting point of your loop. It will keep running the code until the the statement is false while (BTC <= 6000) // this is the ending point of your look { cout << "BTC is " << BTC << endl; // if you want it to stop the infinite loop at some point, you change the value of the variable so the loop can hit that spot and stop the script BTC++; // this is te increment of 1 everytime } double Total_BTC; double BTC_USD; double Total_LTC; double LTC_USD; double total = 0.00; int Total_Entries = 1; while (Total_Entries <= 4) { cin >> "How many BTCs you have?" >> Total_BTC; cin >> "How much is each BTC in Dollars now?" >> BTC_USD; cin >> "How many LTCs you have?" >> Total_LTC; cin >> "How much each LTC in Dollars now?" >> LTC_USD; total = total + Total_BTC + BTC_USD + Total_LTC + LTC_USD; Total_Entries++; } cout << "Your total BTC and LTc amount in Dollars is" << total << endl; cin.get(); return 0; }
- Raymond
I get these errors
- Raymond
- Raymond
But string is already included. So the operator should be functional right?
Ибраги́м
Still the King: https://www.phoronix.com/scan.php?page=news_item&px=Red-Hat-Plumbing-Compute-Stack
Ибраги́м
C++ ain't giving up
- Raymond
They`re probably doing it to mine bitcoin easier
olli
// Loops #include <iostream> using namespace std; int main() { //While loops. You put the condition in () just like if statements double BTC = 5857.468; // <<< this is the starting point of your loop. It will keep running the code until the the statement is false while (BTC <= 6000) // this is the ending point of your look { cout << "BTC is " << BTC << endl; // if you want it to stop the infinite loop at some point, you change the value of the variable so the loop can hit that spot and stop the script BTC++; // this is te increment of 1 everytime } double Total_BTC; double BTC_USD; double Total_LTC; double LTC_USD; double total = 0.00; int Total_Entries = 1; while (Total_Entries <= 4) { cin >> "How many BTCs you have?" >> Total_BTC; cin >> "How much is each BTC in Dollars now?" >> BTC_USD; cin >> "How many LTCs you have?" >> Total_LTC; cin >> "How much each LTC in Dollars now?" >> LTC_USD; total = total + Total_BTC + BTC_USD + Total_LTC + LTC_USD; Total_Entries++; } cout << "Your total BTC and LTc amount in Dollars is" << total << endl; cin.get(); return 0; }
don't you want to print there (at least the string, you cannot assign to a string literal)? (cout instead of cin ?) cin >> "How many BTCs you have?" >> Total_BTC; cin >> "How much is each BTC in Dollars now?" >> BTC_USD; cin >> "How many LTCs you have?" >> Total_LTC; cin >> "How much each LTC in Dollars now?" >> LTC_USD;
- Raymond
No. I want a person to enter these 4 numbers and then I calculate them
- Raymond
I also tried like this too
- Raymond
cin >> "How many BTCs you have?"; cin >> Total_BTC; cin >> "How much is each BTC in Dollars now?"; cin >> BTC_USD; cin >> "How many LTCs you have?"; cin >> Total_LTC; cin >> "How much each LTC in Dollars now?"; cin >> LTC_USD;
- Raymond
But I still get » operator error in all varible lines
- Raymond
Oh right...
olli
But I still get » operator error in all varible lines
like cout << "How many BTCs you have?"; cin >> Total_BTC;
- Raymond
OMG it worked perfectly. You were right. Thank you very much
olli
no worries :)
Maxim Khromov
https://prnt.sc/ljoo0y
Maxim Khromov
how can i check that's a number?
Maxim Khromov
not a string
Dima
Check scanf return value, it indicates that it succeeded
Maxim Khromov
What does it mean?
Rev. Astral
um
Rev. Astral
problem
Rev. Astral
I'm trying to comple something in C++
Rev. Astral
its telling me that a declaration doesn't match, yet I have that declaration in an .h file
Rev. Astral
I figured it out
Rev. Astral
the .h was GLint, and the cpp was trying to call GLfloat
Rev. Astral
whoops
Anonymous
👍
- Raymond
I`m using Visual Studio for my C++. What version of c++ am I using?
- Raymond
How can I find that out?
klimi
Hmmm
klimi
That's interesting question
klimi
I`m using Visual Studio for my C++. What version of c++ am I using?
Visual Studio 2005 - Visual C++ 8.0 Visual Studio 2008 - Visual C++ 9.0 Visual Studio 2010 - Visual C++ 10.0 Visual Studio 2012 - Visual C++ 11.0 Visual Studio 2013 - Visual C++ 12.0 Visual Studio 2015 - Visual C++ 14.0 Visual Studio 2017 - Visual C++ 14.1
- Raymond
👍
klimi
Then I must have found old versions
Stanislav
Oh
my mistake, 15.0-15.9 is a version of visual studio, vc++ toolchain is 14.1x
klimi
Oh
Anonymous
Oh shit
Anonymous
Ariana
woah
Anonymous
What's next, Visual Studio?
Anonymous
why is cin.ignore() is used in turbo c++?
Anonymous
what is the difference b/w cin»ch; and cin.get(); and cin.getline(name,30)
BinaryByter
try it out on this sentence: hello i am cool
BinaryByter
why is cin.ignore() is used in turbo c++?
it is still used in c++ but ive never used it tbh
Anonymous
yeah i saw it being used in some old codes
Anonymous
from the net
Anonymous
I wanted to write a program that checks whether a number is prime or not but I got stuck in here
Anonymous
Could someone help me please
Ariana
Try it
Ariana
like run the program
Anonymous
I tried to write “the number is prime” out of the for loop
Ariana
Ok first
Ariana
What if its not prime
Ariana
I tried to write “the number is prime” out of the for loop
Actually no, try this with different input
Anonymous
I dont know how
Anonymous
I tried to write “the number is prime” out of the for loop
When I do it shows that if number is not prime
Ariana
No like
Ariana
Run the program with different inputs
Ariana
3,4,5,6,7,8,9
Ariana
Just try
BinaryByter
3,4,5,6,7,8,9
thats the harmonic series without the division and without the first two terms
Ariana
XD
Anonymous
I did this and it worked but I am not sure if this practical
j
#include "numLowerCase.h" #include <stdio.h> #include <string.h> int numLowerCase(char *inputString){ int sol = 0; for(size_t e=0; inputString[e] != '\0'; e++){ if(inputString[e]>='a' && inputString[e]<='z'){ sol += 1; } } return sol; }
j
why does it say unknow data type named size_t??
j
after building project it seems to be working