warning: left shift count >= width of type

I am getting this error whenever i am trying to compile the program.


#include<iostream>
using namespace std;
void printstars(int blanks,int starsinline);
int main()
{
int nooflines,counter,noofblanks;
cout<<"Enter the number of star lines(1 to 20) to be printed ";
cin>>nooflines;
cout<<endl;
while(nooflines<0||nooflines>20)
{
cout<<"Numbers of star lines should be between 1 and 20 "<<endl;
cout<<"Enter the number of star lines (1 to 20 ) to be printed:";
cin>>nooflines;
}
for(counter=1; counter<=nooflines; counter++)
{
printstars(nooflines,counter);
noofblanks--;
}
return 0;
}
void printsatrs(int blanks,int starsinline)
{
int count;
for(count=1;count<=blanks;count++)
count<<' ';
for (count=1;count<=starsinline; count++)
cout<<"*";
cout<<endl;
}
count<<' ';
You meant to do cout.

Also, for next time, please note that you can edit your post and add [code] {code here} [/code] tags around your code.

Also also, technically a warning is not an error; but often a warning means that part of your code will not run in the way you, the programmer, expect it to. (In this case, your code is doing a useless left shift instead of printing out what you actually wanted.)
Last edited on
Also, for next time, please note that you can edit your post and add {code here} tags around your code. Will you please tell me about this what is this. i am new here.
And there is also an error,which is saying that says undefined printstars(int,int).
what does it means.
Look at your 2nd post and see what happened. Do the same thing to the code in your original post. (Also read my reply in the other thread)

You can also properly quote people by surrounding the quote with [quote] and [/quote].

Your error is due to a typo, you misspelled printstars as printsatrs.
Last edited on
void printsatrs(int blanks,int starsinline) //spelling mistake

to get code tags , edit your post, slect the code then press the <> button on the format menu on the right

www.cplusplus.com/articles/z13hAqkS/
thanks to all of you,for helpint me.
Topic archived. No new replies allowed.