Posts
 
Reputation
Joined
Last Seen
Strength to Increase Rep
+0
Strength to Decrease Rep
-0
0% Quality Score
Upvotes Received
0
Posts with Upvotes
0
Upvoting Members
0
Downvotes Received
1
Posts with Downvotes
1
Downvoting Members
1
1 Commented Post
0 Endorsements
Ranked #2K
~27.4K People Reached
Favorite Forums
Favorite Tags

14 Posted Topics

Member Avatar for ironmancpp

At a first glance here are a few suggestions: check1 is not running. Your code is faulty because once check1==0 it should come out of the for loops because there is no need for further iterations which it is not. check2 is unable to check the first word for previous …

Member Avatar for mtbs1826
0
238
Member Avatar for codemogul
Member Avatar for wdearth

Please use Code Tags [CODE] #include<iostream> #include<iomanip> #include<string> using namespace std; double catererCal(); //function declration double discountCal(); //functin declaration void printBill(); //function declaration int adults; int children; double ameals; double cmeals; char mealtype; char weekend; string mealtype2; double deposit; double dmeals=15.80; double smeals=11.75; double foodtotal; double surcharge; double totalbill; double …

Member Avatar for mtbs1826
0
227
Member Avatar for keweul
Member Avatar for realproskater
Member Avatar for mtbs1826
0
688
Member Avatar for georgy9002

added a ondraw() function which draws a filled rectangle when flag is true and its boundary only when flag false. You can change the character easily. call it from main(). [CODE] #include <iostream> #include<iomanip> using namespace std; class Rectangle { private: double height; double width; char ch; bool val; public: …

Member Avatar for mtbs1826
0
172
Member Avatar for im abcd

Your while statement does not check anything. The continue and breaks are inappropriate. Scanf is C and input in c has nothing to do in the program. You can use a do while loop like [CODE] # include <stdio.h> # include <iostream> using namespace std; int main() { int a,b,c; …

Member Avatar for elsiekins
0
200
Member Avatar for baltik08

[CODE] #include<iostream> #include<fstream> #include<string> using namespace std; int main() { int count=0; string str; cout<<"Enter string: "; cin >> str; for(int y=0;y<str.length();y++) { if (isdigit(str[y])) /* or if((int)str[y]>47 && (int)str[y]<58) */ { cout<<str<<endl; } } return 0; } [/CODE]

Member Avatar for Dhruv Gairola
0
793
Member Avatar for tln26

>>can u make me a multiplication table using a for loop and arrays in c++??? plsss can u?? Arrays wont be required here. Try this. [CODE] int main() { int num; cout<<"Enter table no.: "; cin>>num; if(num>0) { for (int x=1;x<=20;x++) { cout<<num<<"x"<<x<<"="<<num*x<<endl; } } else { cout<<"Not a valid …

Member Avatar for hits86
0
380
Member Avatar for xiansen

You can try this: [CODE] #include<iostream> #include<math.h> using namespace std; int main() { int y=0; cout<<"Number of times"; cin>>y; for(int n=0;n<y;n++) { char str[5]; cout<<"Enter 5 nos.: "; cin>>str; if(!str) return 0; for (int count=0;count<5;count++) { cout<<pow(str[count]-'0',1)<<" "<<pow(str[count]-'0',2)<<" "<<pow(str[count]-'0',3)<<endl; } } return 0; } [/CODE]

Member Avatar for xiansen
0
296
Member Avatar for darkroad

[CODE] #include<iostream> using namespace std; int sumdigits(int x) { int total = 0; while(x>0) { total+=(x%10); x/= 10; } return total; } int main() { int number=0; cout<<"Enter a number"; cin>>number; int result=sumdigits(number); if(result<10) { cout<<"Total is: "<<result<<endl; exit(0); } while(result>9) { result=sumdigits(result); } cout<<"Total is: "<<result<<endl; return 0; } …

Member Avatar for ananda2007
0
167
Member Avatar for saanda

You can try out this. Only you cannot press enter after the ending line. #include<iostream> #include<fstream> using namespce std; int main() { int x=0, y=1; char ch; ifstream in("file.txt"); while(in.get(ch)) { if (ch!='\n' && isspace(ch)) { x++; } else if (ch=='\n') { cout<<"Line"<<y<<":"<<x+1<<endl; x=0; y++; } } return 0; }

Member Avatar for mtbs1826
0
20K
Member Avatar for vandadm

>>Can you think of another way to get populate the scores array, other than a for loop? Thats pretty simple to code. But sice you asked [CODE] #include<iostream> using namespace std; int main() { double marks1[1],marks2[1],marks3[1],marks4[1],marks5[1]; int x=1; while(x<=5) { int total=0; int average; cout<<"Enter 5 marks for student"<<" "<<x<<":"<<endl; …

Member Avatar for tesuji
0
210
Member Avatar for mommabear

Assuming NumTemperatures is greater than 9. [CODE] void DisplayTemperatures(int Temperatures[], int NumTemperatures, int AverageTemp, int lowTemp, int highTemp) { cout << fixed << setprecision (2); cout << "Hour" << setw(9) << " Temperature\n"; for (int x=0;x<10;++x) { cout<< setw(2) << "0" << x << ":00" << setw(7) << Temperatures[x] << …

Member Avatar for mike_2000_17
0
350

The End.