- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 4
- Posts with Upvotes
- 4
- Upvoting Members
- 3
- Downvotes Received
- 9
- Posts with Downvotes
- 5
- Downvoting Members
- 6
9 Posted Topics
Yes we can do so . We can create an array of objects for any class , irrespective of whether it has a default constructor or not . Moreover , the default constructor is also provided by the compiler . :D
To all those who use C++ and to the creator of C++ . I want to ask a question . What is the use of the default case in a switch statement ? It is actually to be executed when no case is satisfied , but it is executed even …
Show us your program . We'll help you. But for the basic idea , use an if else statement .
Try using this code : (Simple and easy) #include<iostream.h> #include<stdio.h> #include<string.h> void main() { char ch[50]; int c=0,w=1; cout<<"Enter the phrase : "; gets(ch); for(int i=0;i<strlen(ch);i++) { if(ch[i]==' ') w++; else c++; } cout<<"Number of words :"<<w<<endl; cout<<"Number of letters :"<<c<<endl; }
Any idea for a simple C++ project for class 12 ? I thought of and also got many ideas like railway reservation , library management , tic tac toe game , book shop management . But those are too mainstream . Anything else by anyone ? I would be highly …
Try using the random(int); function after calling randomize(); . Hope it works . random(n); generates any random number from 0 to n-1 .
Think out the logic first, simple logic. Use input streams to enter the number of players and the names of the players . Then use the random(); function to generate a number for each palyer and save it to their scores . Then , finally , use the output streams …
#include<iostream.h> void main() { int x=3; for(int i=1;i<=3;i++) { for(int j=1;j<=i;j++) cout<<x<<" "; x=x+3; cout<<endl; } } Fully tested. Hope you like it :D .
The End.
Avishek_1